Values are getting submitted even though they are unchanged.

Values are getting submitted even though they are unchanged.

networkadmin@asaiatm.comnetworkadmin@asaiatm.com Posts: 8Questions: 4Answers: 0
edited March 2023 in Free community support

i have inline as well as edit icon top change the data with multiple select fields, but if i change one field the other 5 are also gettting submitted although I have form options provided.

Can you let me know why values are submitted even though options re provided.

editor.on(" edit ", function() {editor.off("preClose");}).on("open", function() {           
                openVals = JSON.stringify(editor.get());
                editor.on("preClose", function(e) {                   
                    if (openVals !== JSON.stringify(editor.get())) {
                        return confirm(
                            "You have unsaved changes. Are you sure you want to exit?"
                        );
                    }
                });
            });


 $('#table').on( 'edit', 'tbody tr', function () {
            editor.edit( this, {
                submit: 'changed'
            } );
        } );

//for inline edit
        $('#table').on( 'click', 'tbody td.row-edit', function (e) {
            editor.inline(
                table.cells(this.parentNode, '*').nodes(),
                {
                    cancelHtml: '<i class="fa fa-times"></i>',
                    cancelTrigger: 'span.cancel',
                    submitHtml: '<i class="fa fa-floppy-o"></i>',
                    submitTrigger: 'span.edit',
                },{
                    submit: 'changed'
                }
            );
        } );

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,272Questions: 1Answers: 10,212 Site admin

    Sounds like Editor is detected the values as changed. Possibly this is due to a typing issue - for example 5 !== '5'. Editor uses a strict comparison.

    If you can give me a link to the page showing the issue I can look into it.

    Allan

  • networkadmin@asaiatm.comnetworkadmin@asaiatm.com Posts: 8Questions: 4Answers: 0

    this is more of an intranet website so will not be able to show it, is there any way you can direct me so that I can see where this comparison is happening?

  • networkadmin@asaiatm.comnetworkadmin@asaiatm.com Posts: 8Questions: 4Answers: 0

    updated the init-param in js directly and it worked, will look for a solution once posted here.

  • allanallan Posts: 62,272Questions: 1Answers: 10,212 Site admin
    Answer ✓

    Look for the compare method. This is it's Typescript source:

        public compare(value, original) {
            let compare = this.s.opts.compare || util.deepCompare;
            return compare(value, original);
        }
    

    Most fields do not provide their own compare function so search for the source for deepCompare and that will likely be the function that is being run for the comparison.

    Allan

Sign In or Register to comment.