Jump to content
  • 0

Conditional fields - fields with default values dont send that value if hidden by rule.


roattw

Question

I have several fields with a Yes No radio button and NO is set as default answer.  Using rules I have some fields conditionally hidden.  If these fields are set to not show by a rule and the form is submitted the table doesnt receive the default No option, comes over as blank.  Way to send all field results and thier defaults even if not shown by a rule?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hello @roattw,

Once the field is being hidden using rules and this specific field has default value, the value itself will not be stored inside the table once submitted since it is hidden and considered as non existing field. If you want to achieve your current workflow, you may need a JavaScript code that will hide a field based on a checkbox. If you are familiar with Javascript, you may use the code below, paste it in the Footer and play around with it: 

 

<script>
document.addEventListener("DataPageReady", function() {

field = document.querySelector('input[id^="InsertRecordName"]');
label = document.querySelector('label[for*="InsertRecordName"]');

if (document.getElementById("cbParamVirtual1").checked) {
field.style.display = "inline";
label.style.display = "inline";
}
else {
field.style.display = "none";
label.style.display = "none";
}

document.getElementById("cbParamVirtual1").onclick = function() {

if (document.getElementById("cbParamVirtual1").checked) {
field.style.display = "inline";
label.style.display = "inline";
}
else {
field.style.display = "none";
label.style.display = "none";
}}});
</script>

The code above will hide the field if the checkbox is not checked. You can modify the code and change the IDs assigned to it based on the ID of your field inside your DataPage.

I hope this works on you end.

Regards,
Barbie

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
Answer this question...

×   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...
×
×
  • Create New...