Available fields available, depending on whether a new record or an edit ?

Available fields available, depending on whether a new record or an edit ?

crush123crush123 Posts: 417Questions: 126Answers: 18

Is it possible to change which fields are shown, according to the above ?

For example, I want a select list available on new record insertion, but this value should not be editable afterwards

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Hi,

    Certainly this is possible - you can use the show() and hide() methods to show and hide the fields. Combine that with the initCreate and initEdit events and you can show and hide whatever fields are required for create and edit.

    Regards,
    Allan

  • crush123crush123 Posts: 417Questions: 126Answers: 18
    edited January 2015

    Thanks Allan,

    took me a little while to implement, I am still a bit of a noob at this.

    This is what I did, it seems to work..

    // Initialise the edit form with patron select hidden, so it cant be edited
        editor.on('initEdit', function () {
                editor.field('tblitem.ItemPatronID')
                    .hide()
        });
    // Initialise the create form with patron select visible, so it can be edited
        editor.on('initCreate', function () {
                editor.field('tblitem.ItemPatronID')
                    .show()
        });
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Looks good - nice one :-)

    Allan

This discussion has been closed.