Prevent changes in middle of cascading selection

Prevent changes in middle of cascading selection

pcjacksonpcjackson Posts: 18Questions: 6Answers: 0

Follow up to this: https://datatables.net/forums/discussion/58890/two-stage-selection#latest

Because I have a cascading selection based on two layers of table joins, technically, the field middle field that relates characters to series are also editable. However, I want to disallow editing this. In the natural course of using the cascading drop down in the manner described in the blog, that won't be a problem. The value sent back to the server will match.

But if I'm Bad Guy McHackerman, I can change that value, which would then cause the value in the database to be changed. Is there a way to validate that the value is unchanged using the Validator class? Or is there a different way to mark this value as not editable on the server side? Or is this taken care of through the fact that a join is used and the server Editor class simply doesn't update anything across a join?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,195Questions: 1Answers: 10,412 Site admin
    Answer ✓

    Or is there a different way to mark this value as not editable on the server side?

    Are you using our PHP libraries for your server-side? If so, then the Field class can be told not to allow setting the value of a field:

    Field::inst('myColumn')->set(false)
    

    The .NET and NodeJS libraries have similar methods.

    Allan

  • pcjacksonpcjackson Posts: 18Questions: 6Answers: 0

    Very easy. Thanks! I feel somewhat dumb for missing that.

This discussion has been closed.