Jump to content

Azriel

Members
  • Posts

    4
  • Joined

  • Last visited

Reputation Activity

  1. Thanks
    Azriel reacted to TsiBiRu in Form Validation, at least one field has value   
    Hello Azriel.
     
    I have similar validation in my App, I have used the JavaScript below to implement this validation.
    <script type= "text/javascript" > var input1 = document.querySelector('#InsertRecordValue1'); var input2 = document.querySelector('#InsertRecordValue2'); var input3 = document.querySelector('#InsertRecordValue3'); var input4 = document.querySelector('#InsertRecordValue4'); document.querySelector('#caspioform').onsubmit = function(e) {     e.preventDefault(); if (input1.value.length > 0){ this.submit(); } else if (input2.value.length > 0){ this.submit(); } else if (input3.value.length > 0){ this.submit(); } else if (input4.value.length > 0){ this.submit(); } else { alert('Please fill at least one field to continue'); input.focus(); } } </script> If the code above will not work, you will need to change the '#InsertRecordValue' on the top most part of the code to the name of your field in your DataPage.
    To see that, just do the steps below.
     
    1. Go to the preview of your DataPage
    2. Press F12 on your keyboard, a form should be display. This is the browser developer console
    3. Press Ctrl + Shift + C on your keyboard, then hover over your text field. You should be able to see its element ID, then click on this field.
    4. You should be redirected to its code, just double click the id of this element. Then paste it on the JavaScript above to update it.
     
     
    Hope this help, if you are having an error making the code above work. Just provide me the URL of your datapage or web page and I will update it for you
     
    Regards
     
×
×
  • Create New...