Differentiate between create and edit in server

Differentiate between create and edit in server

dynasoftdynasoft Posts: 439Questions: 68Answers: 3

Hi

I need to do the above to allow writing to db if the action is a create and prevent writing if action is an edit, this for specific fields. Eg, I wan to do sth like this:

                editor.Field(new Field("MyField")
                    if (update) .Set(false)
                    if (create) .Set(true)
                );

Thanks.

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @dynasoft ,

    Look at the first example on this page here - it's showing how to either update a create time or an edit time, so would apply to your case too.

    Cheers,

    Colin

  • dynasoftdynasoft Posts: 439Questions: 68Answers: 3

    Thanks but I wasn't referring to these events or additional code i need to write before an edit or create. I just want to know how to grab the action currently being done by editor (edit or create) and set '.Set' with false or true. The reason is I have 2 editor js blocsk of code: one for edits and one for creates. They can create rows with all fields but edits is limited to only a handful of fields.

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @dynasoft ,

    Ah, I see. You can get the current action from calling the Action() method, see the docs here.

    Hope that does the trick,

    Cheers,

    Colin

  • dynasoftdynasoft Posts: 439Questions: 68Answers: 3

    Thanks

This discussion has been closed.