Is it possible to not show some fields in Edit modal that are on New model?

Is it possible to not show some fields in Edit modal that are on New model?

JenDJenD Posts: 8Questions: 3Answers: 0

Is this scenario possible:

My table has email, First Name and Last Name.

On a the New modal form, they can enter all 3 of these fields.

But on the Edit modal form, I don't want them to be able to edit the email field, only first name and last name, so can I remove this field on Edit, or disable it?

thanks,

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,990Questions: 87Answers: 421
    Answer ✓

    You need something like this

    editor.on('open', function(e, mode, action) {
        if (action === 'edit') {
           this.hide(['yourField1', 'yourField2']);
        } else {
           this.show(['yourField1', 'yourField2']);
        }
    })
    

    You can use "disable" and "enable" the same way as "hide" and "show". You can also set default values for the fields you hide / disable like this:

    this.set({'yourField1': 0, 'yourField2': 0});
    
Sign In or Register to comment.