validation - why use the blank validator rule in the model for the ID field? cakephp -


I am new to cake and I want to understand the logic behind it. I know that the blank rule is used to ensure that the field is left empty or that white space characters are present in its value, but do not we always want our ID to be equal to some numerical value Ho?

When the user is submitting data that is used to create a new entry in the database, Then you want to let them choose ID when the id field is empty, then the database (or model) will automatically generate a new ID.

Normally the rule 'on' = & gt; 'Create' :

  'id' = & gt; The array ('rule' = & gt; 'blank', 'on' = 'gt;' create ')  

... originally created, does not accept ID Users can select. "Without this rule, the user can select the database id or pass the existing one and overwrite the data.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -