Jump to content
  • 0

disable dropdown list when the value is changed


anibaldps

Question

Help!

Im lost in my own code. I want to have a dropdown list in an UPDATE form. And i have this code that is supposed to check if the the user's department is "CCC" disable the dropdown called Status, else, enable it. But I want to call this function everytime i select something from the RO_AppNum dropdown. And i also want it to run when the page is loaded.

function bloquiar()

{

var NewStatus=document.getElementById("EditRecordStatus");

var dep=document.getElementById("EditRecorddepartamento").value;

var d1=document.getElementById("EditRecordRO_AppNum").value;

if(dep == "CCC"){

NewStatus.disabled = true;

}

else{

NewStatus.disabled = false;

}

}

window.onload=bloquiar;

document.getElementById("caspioform").d1.onchange=bloquiar;

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Just checking couple things:

1. Is your field name "departamento" as referenced in your code?

2. What form element is used for field "RO_AppNum"? If it is "Display Only" it must be changed to a text or hidden field.

3. Instead of "document.getElementById("caspioform").d1.onchange=bloquiar;" use:

document.getElementById("EditRecordRO_AppNum").onchange=bloquiar;

If the tips above does not solve the problem, you may want to use Firebug to further troubleshoot as it shows you the Java Script errors so you can spot and fix them. Firebug is an add-on development tool in Firefox for free.

Cheers,

Barbara

Link to comment
Share on other sites

  • 0

Hi all,

 

You don't need to use JavaScript to disable a dropdown field when certain criteria are met. 

A conditional form is a regular Caspio form with rules consisting of criteria and conditional actions. You can apply conditional rules to create dynamic change forms that fine-tune fields based on user entries.

You may check this article for more information: https://howto.caspio.com/datapages/forms/conditional-forms/

 

Regards,

kristina

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