Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. <apex:page id="page">
  2. <apex:form id="form">
  3. <apex:inputText value="{!a}" id="aid" html-pattern="[a-z]+"/>
  4. <apex:commandButton value="Click" onclick="return validate()"/>
  5. </apex:form>
  6. <apex:page>
  7.  
  8. function validate(){
  9. if(document.getElementById('{!$Component.page.form.aid}').value==''){
  10. document.getElementById('{!$Component.page.form.aid}').style.border = "solid 1px red";
  11. return false;
  12. }
  13. else{
  14. return true;
  15. }
  16. }
  17.  
  18. page:form:1:hhm1FirstName
  19.  
  20. page:form:2:hhm1FirstName
  21.  
  22. <apex:page>
  23. <style type="text/css">
  24. .border {
  25. border-color: red;
  26. border-width: 1px;
  27. border-style: solid;
  28. }
  29. </style>
  30.  
  31. <apex:form>
  32. ...
  33. <apex:inputText value="{!item.FirstName}" styleClass="notBlank"/>
  34. ...
  35. <apex:commandButton value="Click" onclick="return validate()"/>
  36. </apex:form>
  37.  
  38. <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
  39. <script>
  40. var j$ = jQuery.noConflict();
  41. function validate() {
  42. var valid = true;
  43. j$('input.notBlank').each(function() {
  44. if (j$(this).val() == '') {
  45. j$(this).addClass('border');
  46. valid = false;
  47. }
  48. });
  49. return valid;
  50. }
  51. </script>
  52. </apex:page>
  53.  
  54. <apex:page id="myPage">
  55. <apex:variable value="{!1}" var="rowNum"/>
  56.  
  57. <table>
  58. <apex:repeat value="{!yourList}" var="item">
  59. <tr id="hello{!rowNum}"><td>{!item.Name}</td></tr>
  60. <apex:variable var="rowNum" value="{!rowNum + 1}"/>
  61. </apex:repeat>
  62. </table>
  63. </apex:page>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement