Guest User

Untitled

a guest
Jan 18th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. <xp:button id="save_part_btn" value="+Add" style="float:right;">
  2. <xp:eventHandler event="onclick" submit="true"
  3. refreshMode="complete">
  4. <xp:this.action><![CDATA[#{javascript:
  5. /*
  6. var estdoc:NotesDocument=database.getDocumentByUNID(doc_source.getDocument().getParentDocumentUNID())
  7. var estPartdoc:NotesDocument=estdoc.getParentDatabase().createDocument()
  8.  
  9. Ignore it
  10.  
  11. estPartdoc.replaceItemValue('Form','Estimate_Cost_Part')
  12. estPartdoc.replaceItemValue('Predoc',estdoc.getUniversalID())
  13. estPartdoc.replaceItemValue('$OSN_IsSaved','1')
  14. */
  15.  
  16. estPartdoc.replaceItemValue('TSNB_All',getComponent('input_tsnb_all').getValue())
  17.  
  18. }]]></xp:this.action>
  19.  
  20. <xp:this.script><![CDATA[
  21.  
  22. var isValid = true;
  23. var result = "";
  24.  
  25. function isStringEmpty(string2Check)
  26. {
  27. return string2Check == "" || string2Check[0] == " ";
  28. }
  29.  
  30. function isNumberCorrect(number2Check)
  31. {
  32. return /^[1-9]d*(,d{1,3})?$/.test(number2Check.toString());
  33. }
  34.  
  35.  
  36. if(isStringEmpty(document.getElementById("#{id:input_tsnb_all}").value))
  37. {
  38. wholeValid = false;
  39. result += '-The field cannot be emptyn'
  40. }
  41. else if(!isNumberCorrect(document.getElementById("#{id:input_tsnb_all}").value))
  42. {
  43. wholeValid = false;
  44. result += '-The field is not correctn'
  45. }
  46.  
  47. if(!isValid)
  48. alert(result)
  49. return isValid;
  50.  
  51. ]]></xp:this.script>
  52. </xp:eventHandler>
  53. </xp:button>
Add Comment
Please, Sign In to add comment