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

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -