How to Keep Create Form Fields Filled After Submit?

How to Keep Create Form Fields Filled After Submit?

Gulfsav1Gulfsav1 Posts: 5Questions: 2Answers: 0

I've been searching and perhaps not looking at the right spot but how would I keep my form fields filled after adding a new record using the "create/new" button? The editor window closes and my record is added to the table but when I click on "Create/new" again, the form clears all the fields.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Hi,

    The way to have a value show in the "Create" form is to have a default - so you could use fields.def if you want to set a value when the form is first initialised. Or you could use field().def() to set the default dynamically.

    It sounds like you might want a "Save and add another" type button in the form? If so, then You could use a custom button to add such a button - combined with the API to set the values.

    While this example doesn't show exactly what you are looking for, it does show another button on the form, which you might find useful as a starting point.

    Regards,
    Allan

  • Gulfsav1Gulfsav1 Posts: 5Questions: 2Answers: 0

    Hi Allan,

    Thanks for the response. The example you provided is a starting point but is there no function or event that can keep the input fields in the form after submitting the form? Users might get confused with having another button.
    i.e. the create button has form fields firstname, lastname, and age. After submission of the form I'd like to have those same values submitted appear back in the form. Maybe I have to capture the information prior to submit then after the submit use the fields def to repopulate?

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Sure - you could use postCreate to know when a new row has been created and then populate the default values based on the new row's data.

    Allan

This discussion has been closed.