Providing default value for a field through HTML?

Providing default value for a field through HTML?

yetyet Posts: 41Questions: 16Answers: 1

We pass all options through data- attributes.
How can you set a "default" value for a field in "New" mode?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,824Questions: 1Answers: 10,131 Site admin
    Answer ✓

    In the case of Editor it doesn't have options to be initialised from data-* attributes in the same way as DataTables does (i.e. reading them in automatically) - since Editor does not require any elements to be on the page (the form is dynamically added for example).

    What you'd need to do is read the data-* attributes back from whatever element you attach them to (this is how DataTables does it for columns).

    How are you currently configuring Editor? fields.def is the parameter you want to use.

    Thanks,
    Allan

  • yetyet Posts: 41Questions: 16Answers: 1

    Sorry, my mistake...I wrote my initialization from data- attributes a while ago and forgot about it :-)

This discussion has been closed.