bggann
Active Member
I'm trying to use a form java script file to enable/disable certain fields based on another.
I can use this to hide/show, but I don't like that because it messes with the screen format.
But I can't figure out how to set a field to enabled or disabled in form_x.js
Here is my code.
I get an error that 'enable' is not a fuction.
if I use var.hide() or var.show() that works.
I've tried other formats - like state.enable(true); state.enable=true;
Kinda puffin in the dark here.
Help please/
function Manage_Owner_Country_Fields(el) {
// This function enables or disables the other country, other state and state feilds based on country
var country = el.getValue();
var state = el.form.formElements.get('stca_htf___state');
var other_state = el.form.formElements.get('stca_htf___other_state_province');
var other_country = el.form.formElements.get('stca_htf___other_country');
if (country != 'Other') {
state.enable();
other_state.disable();
other_country.disable();
other_state.update('');
other_country.update('');
}
else {
state.disable();
other_state.enable();
other_country.enable();
}
}
I can use this to hide/show, but I don't like that because it messes with the screen format.
But I can't figure out how to set a field to enabled or disabled in form_x.js
Here is my code.
I get an error that 'enable' is not a fuction.
if I use var.hide() or var.show() that works.
I've tried other formats - like state.enable(true); state.enable=true;
Kinda puffin in the dark here.
Help please/
function Manage_Owner_Country_Fields(el) {
// This function enables or disables the other country, other state and state feilds based on country
var country = el.getValue();
var state = el.form.formElements.get('stca_htf___state');
var other_state = el.form.formElements.get('stca_htf___other_state_province');
var other_country = el.form.formElements.get('stca_htf___other_country');
if (country != 'Other') {
state.enable();
other_state.disable();
other_country.disable();
other_state.update('');
other_country.update('');
}
else {
state.disable();
other_state.enable();
other_country.enable();
}
}