On change doesn't work with "Specify your own value"
Posted: 14 Nov 2017
Hi,
I have a choice field that allows you to add your own value ("Specify your own value").
When this choice field changes a function is triggered that gets the value (used in a variable in the function). This works fine when choosing from the dropdown list. So if the:
- user selects ABC in 'MA'
- user selects 123 in 'ChoiceField'
= then 'MAcode' will be ABC123
But the function doesn't trigger when the user fills the field under "Specify your own value". So when the user does not use the dropdown list, but fills the "specify your own value" field, the function doesn't work:
- user selects ABC in 'MA'
- user writes 333 in "Specify your own value" in the 'ChoiceField'
= then 'MAcode' will be ABC but it should be ABC333
The choice field internal name is ChoiceField.
This is how my function is:
function setMAcode() {
var mText = fd.field('MA')control('getSelectedText');
var mNumber = fd.field('ChoiceField').value();
var combined = mText + mNumber;
fd.field('MAcode').value(combined);
}
fd.field('ChoiceField').change(setMAcode);
How can my function pick up the information from the "specify your own value" field?
I have a choice field that allows you to add your own value ("Specify your own value").
When this choice field changes a function is triggered that gets the value (used in a variable in the function). This works fine when choosing from the dropdown list. So if the:
- user selects ABC in 'MA'
- user selects 123 in 'ChoiceField'
= then 'MAcode' will be ABC123
But the function doesn't trigger when the user fills the field under "Specify your own value". So when the user does not use the dropdown list, but fills the "specify your own value" field, the function doesn't work:
- user selects ABC in 'MA'
- user writes 333 in "Specify your own value" in the 'ChoiceField'
= then 'MAcode' will be ABC but it should be ABC333
The choice field internal name is ChoiceField.
This is how my function is:
function setMAcode() {
var mText = fd.field('MA')control('getSelectedText');
var mNumber = fd.field('ChoiceField').value();
var combined = mText + mNumber;
fd.field('MAcode').value(combined);
}
fd.field('ChoiceField').change(setMAcode);
How can my function pick up the information from the "specify your own value" field?