Dropdown to update another dropdown and not update database

Dropdown to update another dropdown and not update database

nicontrolsnicontrols Posts: 16Questions: 7Answers: 1

Is it possible to have a dropdown that updates the contents of another dropdown without committing any changes to the database?

The contents of the 2nd dropdown need to be grabbed from the database.

I can sort of get editor.dependant() working but the first dropdown wants to update the database, which I don't want,

I hope that makes sense.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 2,817Questions: 0Answers: 490

    Hi @nicontrols ,

    Would making it readonly work - that way Editor wouldn't expect to write it back?

    Cheers,

    Colin

  • nicontrolsnicontrols Posts: 16Questions: 7Answers: 1

    To get this to work, I just ended up removing the node from the JSON being submitted to the server.

    In this example, I didn't want the salstkitem table to update, but I still wanted the dropdown functionality. It's a pretty weird situation that not many will encounter I imagine:

                editor.on( 'preSubmit', function ( e, data, action ) {
                    
                    let row = editor.ids();
                    delete data.data[row]['salstkitem'];
    
                } );
    
  • allanallan Posts: 48,322Questions: 1Answers: 6,976 Site admin
    Answer ✓

    Yes! As of Editor 1.8.0 there is the fields.submit option which can be used to prevent the data being submitted to the server for a field.

    Allan

Sign In or Register to comment.