Jump to content

Post a value to field IF one or more fields are selected


Recommended Posts

I have several text fields that are checkboxes. A checked box = "Yes" posted to that field. I would like to have another field automatically post value "Yes" IF one or more of the other fields are checked.

So IF

fieldA or fieldB or fieldC = "Yes" (checked) THEN fieldD = "Yes" (checked)

If fields A,B and C are all unchecked (blank), then fieldD is also unchecked (blank).

NOTE: I will be using this in new submission forms as well as editing detail pages.

Any ideas would be helpful. Thanks!!

Link to comment
Share on other sites

You can try the code below in the footer of the page
 

<script>

function f_check(){
if (document.getElementById("A ID").checked && document.getElementById("B ID").checked&& document.getElementById("C ID").checked) {
alert("yes");
document.getElementById("D ID").checked = true;
}
else if (!(document.getElementById("A ID").checked && document.getElementById("B ID").checked && document.getElementById("C ID").checked)) {
document.getElementById("D ID").checked = false;
}
 }
document.getElementById('caspioform').onsubmit=f_check;
</script>

Replace all IDs with appropriate IDs on your page. In submission page it should be like:InsertRecordFIELDNAME and in details or update page it should be EditRecordFIELDNAME

Link to comment
Share on other sites

  • 4 weeks later...

I have fields to which points need to be assigned. 1st place equals 4 points; 2nd place equals 3 points; and 3rd place equals 2 points.

I need to assign these values as entries are submitted into these places. Any ideas or suggestions would be helpful. Thanks

Link to comment
Share on other sites

  • 5 years later...

Hi @saguaro,

You could try using CASE-WHEN in Calculated Value. As of July 12, 2018, Caspio introduced new features which you can find here: https://howto.caspio.com/release-notes/caspio-bridge-13-0/ This release includes a new feature, Calculated Values in Submission Forms.  This allows you to generate calculations which you can use for your checkbox. 

I hope this helps!

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...