Default value from select dropdown
Default value from select dropdown
gbenett
Posts: 14Questions: 5Answers: 0
In Editor, I'm not sure why the following field doesn't submit "TBD" as a placeholder when the user submits (create or edit) without selecting an option. Everything else is working; I just want a default value when the required data is currently unknown.
fields: [..., {
label: "Db Name:",
name: "CurrentDbName",
type: "select",
placeholder: "Select from DBs on Host:",
placeholderDisabled: false,
placeholderValue: "TBD"
},
]
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
What version of Editor are you using? Can you five me a link to the page showing the error so I can debug it?
Thanks,
Allan
Using Editor 1.5.6 (latest). Can't readily simulate the app outside our firewall -- maybe this is enough? Debug info at http://debug.datatables.net/atodox
The relevant table is #mainTable; relevant row code begins around line 407:
Embarrassingly, that's a bug in Editor 1.5.6 I'm afraid! It is just completely ignoring the placeholder value because of how the value is read from the select element (Editor stores the value on a property of the element to allow for strict type checking).
To patch a local copy against this issue open
dataTables.editor.js
in your Editor and find:Immediately after those two lines add:
I'll have that fix in the next release! Thanks very much for letting me know about this and my apologies for the issue.
Regards,
Allan
Great answer, as usual. Works like a charm.