javascript - Yii notify user about constraint violation -


I am using Yii, and I want to inform the user of the barrier violation while saving the database. But the way I go forward does not fix the problem. This is my code.

Action:

  PublisherAContact ($ id) on public function action {$ model = new PublierAContact; If (isset ($ _ POST ['PublierAContact'])) {$ Model-> Set properties ($ _ POST ['PublierAContact']); {$ Model- & gt; Save (); } Catch (CException $ E) {Yii: app () - & gt; Classic Script- & gt; Register Script ('Publisher', 'Warning ("Deja Light)"); } $ This- & gt; Redirect (array ('view', 'id' = & gt; $ id)); } $ This- & gt; Render ('light connect', array ('model' = & gt; $ model, 'id' = & gt; $ id)); }   

But, along with it, I can not see the alert box in the browser. Can anyone help me fix it quickly? Instead of catching an exception, build your own obstacle check as a verification.

This makes it easy to display model errors on your form.

Comments

Popular posts from this blog

Out of index C/C++ -

regex - PatternSyntaxException: while using String.ReplaceAll function in java? -

java - Projects which are accessed via multiple (different) IDEs: Ant or Maven? -