Grey out certain fields when edit button clicked

Grey out certain fields when edit button clicked

RikerRiker Posts: 9Questions: 2Answers: 1

I have fully functioning server side webpage working that inserts, updates, deletes into SQL perfectly.

The only issue I am having is being able to grey out / make certain fields uneditable when the edit button is clicked.
Currently my SQL is ignoring the fields that I don't want to allow to be updated but it still allows you to edit them in the form.

The fields need to be able to be typed into and populated when New is clicked in order to insert the entry but when edit is clicked for any existing field I need it so 2 or 3 fields can't be typed into and are locked to prevent confusion.

This question has an accepted answers - jump to answer

Answers

  • RikerRiker Posts: 9Questions: 2Answers: 1
    edited August 2020

    Trying to understand how to integrate fields.def for edit only with readonly but not quite getting there

  • RikerRiker Posts: 9Questions: 2Answers: 1

    I've tried this and it does grey out the field on edit but then if you go and click Create / New it still has the fields disabled.

      editor.on('initEdit', function( e, data ) {
        editor.show();
        editor.disable('username');
      });
    
  • RikerRiker Posts: 9Questions: 2Answers: 1
    Answer ✓

    Figured it out,
    I had to add the inverse to the create

        editor.on('initCreate', function( e, data, action ) {
          editor.show();
          editor.enable('username');
    

    });

This discussion has been closed.