6 years ago
Topic

Hello everybody,

I am using some jQuery code (Stuff->Script (JS)) on a "Simple Select" field to provide the select-input with some custom options (a list of server-sided folders which I get by calling a php script with ajax) and up to this point, everything works fine. However, when I try to submit the form, the value of the custom options does not get stored in the database. After some testing, I found out that only options that are predefined in the field's configuration can be stored into the database, but those that are added by my jQuery code can not (as already said). I also checked in my browser's developer tools that the option's value-attribute gets filled in correctly, so this can not be the mistake. 
Can anyone help me with this problem?

Kind regards

Get a Book for SEBLOD
1283 Posts
Bucklash
6 years ago
0
Level 1

Have you tried updating the fields config with new options in beforestore field ?

4229 Posts
Kadministrator
6 years ago
1
Level 1

You can't add new options client side (using javascript), you need to do this on the server side (e.g. in beforeRendr field) as for security reasons all submitted values are compared to the value that exist on the server side and those that are not will not be saved. If you have a known range of all possible values you could specify all of them in the field and then filter those values on client side to show only available ones.

6 years ago
0
Level 2

Thanks for your responses. I solved my problem by adding another text field and setting its value to the select input's value whenever it gets changed.

Get a Book for SEBLOD