Forum

Thread tagged as: Problem, Forum, Forms

Modal box close on form submit

Hi,

I have a bPopup modal box having a perch form. On submit it closes the dialog box even if form has errors. Is there a way in perch to prevent modal dialog close if perch error (e.g. empty fields) exits.

Regards Kuljeet

Vinay Jagessar

Vinay Jagessar 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You'll need to have your front end code re-open the modal if there's an error.

Please let me know where to fire code from

  1. If I fire e.preventDefault then i can't see form errors.
  2. If i put trigger code in PERCH:ERROR section in html file, it is not firing.

Is there is place in perch code where i can fire JS code if perch error is generated and stop event propagation.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, use the error tags.

<perch:error for="all" type="general">
    <script>...</script>
</perch:error>

Ok, thanks iill try