Editor: different form (elements) for create and edit

Editor: different form (elements) for create and edit

asleasle Posts: 96Questions: 28Answers: 0
edited June 2022 in Free community support

I have a order form for data entry and it contains customer info, model purchased etc. This form is passed on to someone in charge of installing the product. So there are fields that should not be editable when one clicks EDIT. And once some fields are filled out they can not be edited again. So in the same table I should be able to create and edit but after creating a record I should not be allowed to edit some fields. After creating a record you should be able to cancel the order, so a cancel button shows up after the record is created: Does anyone have examples of this?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    For the first part, i.e. a field only editable/visible on one of the forms, you can do something like this from this thread.

      editor.on('preOpen', function(e, mode, action) {
        console.log(action)
        if (action === 'create') {
          editor.field('age').enable();      
        }
        else {
          editor.field('age').disable();
        }
      });
    

    For the button, you can have different initialisations for the various modes, please see example here.

    Colin

  • asleasle Posts: 96Questions: 28Answers: 0

    Thanks Colin. It works!

Sign In or Register to comment.