Editor. Select. Default Value.
Editor. Select. Default Value.
Hi.
I am using serverside data with Editor, all working great with various options and select dropdowns pulling data from the database. When I edit a row of data that already has data in the dropdown, how do I get it to show the data in the database - the dropdown currently show a list of the options, but not the value that already exisits in the row of data.
Answers
That shouldn't be the case, it sounds like the format being returned for the edit isn't as expected. It would be worth looking at this example, as it is doing just that. If that doesn't help, could you post your code and the format of the data sent from the server, please.
Colin
Everything is OK until I introduce a select into the fields
type: "select"
If I leave the select out it returns to correct values in editor.
...
This error is usually because of a mix up in the label and the value. Is
payment_terms.payment_terms_name
really the field you want to edit the value of here? I would have thought that you would want to editcustomers.customer_payment_terms_id
which would have its options based on thepayment_terms
table. For example:And on the server-side:
Allan
Hi Allan, thanks for coming back to me. Tis makes sense. I have made the changes but now I have lost both fields on the editor. Here is the JS
Here is the PHP
When you say you have lost them, do you mean they no longer appear in the form? I don't see anything in the above that would cause that.
Can you give me a link to your page so I can take a look at debug it directly please?
Thanks,
Allan
Here you go Allan. I have removed the login for you to test, please notify me when you are done. Thanks.
https://thebusinessmanual.co.uk/admin/index.php?customers
Thanks!
You've got a custom template and two fields are commented out:
The second one (
customers.payment_terms
) needs to be updated to becustomers.customer_payment_terms_id
.Nice use of a template btw - it looks good.
Allan
Thank you. All fixed. Such a fantastic tool - huge kudos to all involved that developed it.