Jump to content
  • 0

Show hidden field if 'Other" is selected from dropbox


fishsticks

Question

I want to hide/show a field based on a specific value from another field. My web form has a dropbox field called 'Devices'. One of the dropbox options is "Other." If the user selects "Other," I want a textbox field (called 'DescOther') to appear so that they can describe whatever Other is. The textbox should automatically be hidden on page load and only be visible when 'Other' is selected.

Please help!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
If it is a submission page and you would like to disable the text field you can add an HTML block and try a code like: 

 



<script>
function d_text()
{
document.getElementById("InsertRecordDevices").disabled = true;
}
function check_txt(){
var e = document.getElementById("InsertRecordDescOther");
var strUser = e.options[e.selectedIndex].value;
if (strUser == "other")
{
document.getElementById("InsertRecordDevices").disabled = false;}
else {document.getElementById("InsertRecordDevices").disabled = true;}
}
window.onload = d_text;
document.getElementById("InsertRecordDescOther").onclick = check_txt;
</script>


 

If it is an update page then you can replace all "InsertRecord" with "EditRecord".

 

If you would like to hide the text field please provide the link of the page so I can take a look to see how we can reference the text field there. 

 

Cheers!

Link to comment
Share on other sites

  • 0

Hi. Just an update on the new version of Caspio, this can be achieved using Conditional Forms (Rules). If the field = Other then another field will appear. Rules is consisting of criteria and conditional actions. You can apply conditional rules to create dynamic change forms that fine tune fields based on user entries. In the Rules tab of the DataPage wizard, you can create various conditions to hide, show, require or disable specific fields based on the value or selection of other fields in the same form. The following conditions can be applied to Caspio forms (submission, search, single record update, or details page):
- Hide/show fields or a section of fields
- Make fields required
- Disable a field
- Make fields Display Only (non-editable)

https://howto.caspio.com/datapages/forms/conditional-forms/

https://www.youtube.com/watch?v=T_Ivf-oqiQg

 

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