I am seeing weird behavior of a select field on a ...
# suitescript
a
I am seeing weird behavior of a select field on a Suitelet after using the .addSelectOptions method. The values I added to the field are present but I am unable to select any of them. Any thoughts on what I missed? Here is the code snippet of the field add and select options add:
Copy code
var refundMethod = form.addField({
    id: 'custpage_refund_type',
    type: serverWidget.FieldType.SELECT,
    label: 'Refund Method'
});
refundMethod.addSelectOption({value: '',text: ''});
refundMethod.addSelectOption({value: 1,text: 'Check'});
refundMethod.addSelectOption({value: 2,text: 'EFT'});
a
when I'm using a placeholder option I still give it an actual numeric value, and a text like "Please Select..." I don't know if your empty string for value would be a problem though, that's the only thing I'm seeing in this snippet that isn't perfectly normal
n
I am guessing the same 👆 Provide a value of -1 to your first option.
m
the initial null value isn't typically a problem, i use this frequently. i'd suspect something else is causing a problem and making it appear as though the select does not work
you could try specifying a defaultValue and see what happens
a
right, I wasn't really thinking that was the issue, I was assuming it was something NOT in the snippet causing issues
💯 1
n
Then may be it is the attached client script. Either validate field or it is crashing.
m
both are where my mind was
a
if something is erroring front side you might have some error long in the dev tool console