I am using following code snippet in Description to populate the value in field B depending on what value is selected from field A, using field A onchange trigger.
<script type="text/javascript">
sid = document.getElementById('customfield_10087');
if (sid) {
target = document.getElementById('customfield_10097');
if (sid.value == "ABBOTSFORD PUBLIC SCHOOL (ABBOTSFORD)") target.value="hi this is done";
sid.onchange=function() {
target.value=this.value
}
}
</script>
Field A is select list but when in use field A.Value in my code it returns a number instead of the literal value of the selection. I have to populate filed B based on what is selected in field A but I am not able to compare as I said the value returned is number and the not the literal value that I select.
My second if statement above never returns true because sid.value is returned as a number or id of "ABBOTSFORD PUBLIC SCHOOL (ABBOTSFORD)"
How do I map this id to my literal value?
Perhaps the reason for this is because the value of a single select list type field is a LazyLoadedOption object and not a string representation of its value. The number you are getting is probably that very option's id.
Thanks Ivan.
Is there a property that provides the actual stored value and not it number representation? There definitely will be some mapping somewhere between these numbers and the actual value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not with javascript, you need to work with the numbers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.