type radio with def value, not taking changed value on editor standalone changed mode
type radio with def value, not taking changed value on editor standalone changed mode
Hi,
I'm in trouble with option "changed" of standalone and radio button.
I have one field set with a default value : "portrait" when declared.
The radio button have 2 values : "portrait" and "landscape"
When I'm choosing the "landscape" value, editor send a POST and submit the changed well.
But if landscape was selected and i want to choose "portrait", field is set with "portrait"'s value, but POST wasn't send and value in data base not changed.
When i'm looking in the editor js file, in line 4439, there is this code :
...
field.multiSet( idSrc, val !== undefined ?
val :
field.def()
);
...
If i comment the ligne
field.multiSet( idSrc, val !== undefined ?
val :
field.def() );
Editor send POST and change value in data base well. But not if the ligne is uncomment.
Is there a bug with "def" value in "changed" mode ? Because it seems "def" value is setting when editor's edit is loading on the field, and a difference between the two value (default and new selected) is made and like value are same, that's not sending POST.
Or have I miss a thing with radio and changed mode from standalone when declare it ?
P.S : same problem with checkbox button.
Best regards
This question has an accepted answers - jump to answer
Answers
I forgort to tell that we're using the editor with edit false option.
Can you try:
to make it an ID selector please?
If that doesn't fix it, can you link to the page so I can debug the issue please?
Thanks,
Allan
Thank you for the answer but it's not working.
I think it is a Bug but I may be wrong.
Let me explain again more clearly
1- We are using an instance editor in ** standalone mode** (no table specified) and server side
2- We chosed submit option -> submit:"changed"
3- We got a field with** type :"radio"** and with default def:"myValue" specified
When we try to programmatically set the value of the field with myValue an ajax call should be send, but it never occures
I can not give you a link, but you will find here a simple test page that illustrate the bug
Thanks for the test case! I think this is actually expected behaviour for the way that Editor is currently setup. The value (because of the default) is "Enabled", and the the field is set to that value again, thus the
submit: 'change'
sees no change in value and submits nothing.The fact that this is standalone without any backing data makes a big difference. When editing a DataTable, the default value is more or less meaningless for an
edit
action since the value will already exist, and thus the value is used, not the default (default is typically only going to be relevant oncreate
).I can see that it perhaps isn't ideal for your use case, but this is the behaviour I would expect Editor to have for this setup.
You either need to remove the default or use
submit: 'all'
for such a case.Regards,
Allan
Thanks Allan that's clear now