HI JD!
Thanks for the reply.
- Initially I had tried only one field, the dropdown fieldValue change. The value changed. But the error is thrown while returning or outside the event handler, I suppose.
(I have added a lot of console log stmts which I removed in the post to the make the code small
)
let coursename = dropdownoptions[index].label ; // set value to readable Name
event.fields[i].fieldValue = coursename; // Error
//Wix Forms: OnWixFormSubmitHookError => changes to fields are not valid
- So I tried a field value change for another basic type which is a text field, and it worked.
let coursename = "FIRST NAME"; // Another field (input25) type Text
if (event.fields[i].id === "input25"){
event.fields[i].fieldValue = coursename; // FieldValue Changes - Works
}
3)I set the dropdown fieldValue to “”. It works. No error, the form submission mail shows Cours Name: -
event.fields[i].fieldValue = ""; // FieldValue Changes - Works
- I set it the original value again. It works. No error.
let coursename = dropdownoptions[index].value ; // set coursename to option's value
event.fields[i].fieldValue = coursename; // FieldValue Changes - Works
-
- I set it another option’s value. It works. No error.
let coursename = dropdownoptions[index+1].value ; // set coursename to next option's value in the dropdown
event.fields[i].fieldValue = coursename; // FieldValue Changes - Works
- When I set it to just " ", (a space), error is thrown.
event.fields[i].fieldValue = " "; // Error
//Wix Forms: OnWixFormSubmitHookError => changes to fields are not valid
Looks like, though the dropdown value is a string, it does not accept any value other than one of the values of its options or undefined “”.
Pls throw some light and suggest a work around.
Thanks
Gita