Page 1 of 1

Can you set the default value for a select box?

Posted: Fri Feb 13, 2015 5:51 pm
by rmarsh
I've set up a couple of select boxes that work well but in some cases I would like the default selection to be different than what is showing up.

It appears that the last selection is the default. Is there anyway to cause it to response to what is already in the 5250 fields?

For example if I_26_12 contains a "1" set the default to "Yes".

Re: Can you set the default value for a select box?

Posted: Fri Feb 13, 2015 6:28 pm
by Scott Klement
The 'default' selection (the one that's selected when the select box is first shown to the user) is based on the value that's in the underlying green-screen field.

So if you have a select box that has 'Yes' and 'No' as choices, and 'Y' and 'N' as the corresponding values, then when the green-screen sends Y, it will set the select box to "Yes", and when the green-screen sends "N" the select box is set to "No".

The only time it'd pick one that doesn't select to the green-screen field's value is if there is no match. (i.e. the select box does not have a value that matches the green-screen field value.) This is considered an "invalid" situation -- the list of values should always include all possible values that can ever be in the field. The only exception is when using a database-driven select box, you may want blanks to be a valid option (despite that it's not in the database.) In that situation you can use the "blank option" fields to enable blanks as a valid value.

Re: Can you set the default value for a select box?

Posted: Mon Feb 16, 2015 3:04 pm
by rmarsh
That is what is happening. I had to go back and double check it. Thank you.