Clear input on failed data validation

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
kestabacsi
Posts: 2
Joined: 2015-06-16 18:35

Clear input on failed data validation

Post by kestabacsi » 2016-12-14 13:48

Hello!

At this moment i use in common.js.php the following code to compare the ship and prod fileds:

Code: Select all

if($j('#ship').val() != $j('#prod').val()){ modal_window({ message: '<div class="alert alert-danger"><?php echo addslashes($Translation['field not equal']); ?></div>', title: "<?php echo addslashes($Translation['error:']); ?> Sz&#225;ll&#237;t&#243;lev&#233;lr&#337;l  k&#243;d", close: function(){ $j('[name=ship]').focus(); $j('[name=ship]').parents('.form-group').addClass('has-error'); } }); return false; };
This works Ok, but i would need, that when the focus is set on the "ship" field, the content should be deleted. Now the previously entered wrong content stays.

Any help would be greately appreciated.

Post Reply