Create v Edit submit scope

Create v Edit submit scope

anotherlawanotherlaw Posts: 7Questions: 4Answers: 0
edited May 2019 in Free community support

Hi Allan,

I'm wanting to limit the range of fields submitted to the service on main (actually main-create) rather than bubble (bubble-edit).
I've got the following set within the editor definition, .

        formOptions: {
                            bubble: {
                                onBlur: 'submit',
                                onReturn: 'none',
                                onEsc: 'close',
                                submit: 'allIfChanged'
                            },
                            main: {
                                submit: 'changed'
                            }
                        },

however the main:submit:'changed' seems be being ignored as server side logging is showing that all fields are being submitted.

Thoughts as to what I'm going wrong? or even if this is possible?

Steve

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @anotherlaw ,

    I'm not seeing that here. This is a bit cobbled together, as the server-side script isn't Editor compatible, but you can check the network tab on the developer's tools to see what is being sent - and here, as you can see only the edited fields are being sent.

    Would you be able to modify that example to demonstrate the problem, or link to your page if possible?

    Cheers,

    Colin

  • anotherlawanotherlaw Posts: 7Questions: 4Answers: 0

    Colin,

    Thanks for responding ... the example does exhibit the problem I've described.

    When creating a NEW entry ... fill in just the "name" and "position" fields .... the request data sent is all five fields rather than just two into which I've input data.

    My app contains dozens of fields, although only about five are 'needed' during create .... but all are included at submission.

    I'd hope that this wasn't the case as it means coding a lot of null-case scenarios into the client side code .... of course possible but for a marginal use-case seems a lot of complexity being introduced an already busy codebase.

    I've managed a bit of a nasty workaround .... hooking my own SQL insert script to the server-side PreCreate action. Hardly ideal but a lot less work than the alternative.

    Steve

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin
    Answer ✓

    however the main:submit:'changed' seems be being ignored as server side logging is showing that all fields are being submitted.

    All of the fields have new values on create (even if they are just given the default value). For that reason, it will always submit all fields on create.

    Are you looking to have empty fields and mark them an null in the db? The ifEmpty set formatter in our server-side libraries could be used for that.

    Allan

This discussion has been closed.