Jump to content

Multiple Checkbox Fields Value Check Against Dropdown Field Value


Recommended Posts

Hello,

 

I have 10 checkbox fields and 1 dropdown field. I need to restrict user from submitting form if any of the 10 checkbox fields are checked and if the dropdown value equals No. Ideally I would like to inform the user via message and disable submit button until condition is corrected.

Link to comment
Share on other sites

Hello ccarls3, 


 


Here is a script which might help you.


 


For my app I used ten CheckBox Fields and one Dropdown Field with "Yes" and "No" values.


 


On the Configure Fields step of your Submission Form add the Header&Footer element. Select the Header element , click on the "Source" button  and insert the following script there :


 


 


<SCRIPT LANGUAGE="JavaScript">

 

function concatenate()

{

 

  var x1 = document.getElementById("InsertRecordCheckBox1").checked;

  var x2 = document.getElementById("InsertRecordCheckBox2").checked;

  var x3 = document.getElementById("InsertRecordCheckBox3").checked;

  var x4 = document.getElementById("InsertRecordCheckBox4").checked;

  var x5 = document.getElementById("InsertRecordCheckBox5").checked;

  var x6 = document.getElementById("InsertRecordCheckBox6").checked;

  var x7 = document.getElementById("InsertRecordCheckBox7").checked;

  var x8 = document.getElementById("InsertRecordCheckBox8").checked;

  var x9 = document.getElementById("InsertRecordCheckBox9").checked;

  var x10 = document.getElementById("InsertRecordCheckBox10").checked;

  var x11 = document.getElementById("InsertRecordDropdown").value;

 

 

  if (x11=='No')

  {

    if (x1 || x2 || x3 || x4 || x5 || x6 || x7 || x8|| x9 || x10)    

     {

 

/* "MESSAGE" is the text for displaying if you want to disable Submit Button . */

      alert("MESSAGE");

       return false;

      }

  }

}

document.getElementById("caspioform").onsubmit=concatenate;

</SCRIPT>

 

 

I hope it helps you !

 

Regards, 

 

Aurora

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...