JavaScript to Disable/Enable do not work Equally

eugenecjr

Member
To explain a little better. I have an element where I have included JavaScript such that when set to a specific value a dropdown is disabled. that works just fine. However, when I change the value to a value intended to re-enable the dropdown it will not enable. I have checked more then a dozen times that I have the rules setup properly as on change and value set to Employee enable dropdown Employee and on change and value not set to Employee disable dropdown Employee.

Regards,
-Eugene
 
I have attached a screen shot of the issue. There may be a better way to go about what I am looking to do, however I am working with three elements. The value of location determines the settings for store and employee. The reason I am disabling employee is due to the fact that the value is pulled from another table and I am not able to set a blank/NULL value. If you can imagine I am pulling from the Joomla users that are known to be employees. By disabling this field no value is store and then I hide it as well.

Let me know if you have any questions.
 

Attachments

  • support01.JPG
    support01.JPG
    113.6 KB · Views: 5
The first thing you probably want to try is to use the dropdown values and not the dropdown labels i.e. Employee is the displayed label, but you may be using a number in the database to represent that rather than the string "Employee".

If that doesn't work, please post again with details of the type of element that store and employee are just in case they are list-type elements (which seem to have some javascript issues).
 
Both the label and the value are the same. i.e what the user selects and what is written to the database. However, as a test I went through and reset the values to 1,2,3 and updated the javascript accordingly. The results are the same. I am wondering if this is a chicken/egg situation. Is the java looking at the value of the element or is it looking at the value in the database? This comes from the fact that when I save the record even though I am not able to change the employee when location is set to employee, then reopen the element is then enabled allowing me to make the proper selection. Seems odd since I have this set on change and their for the value would not actually be saved to the database until it is saved. Just a thought if you follow what I am saying.
 
Are you getting any Javascript errors in your javascript console when you change the location element?
 
Both are dropdown elements, where store is static with the value and label defined in the element, and employee is pulling from the joomla users.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top