Page 1 of 1

Clear input on failed data validation

Posted: 2016-12-14 13:48
by kestabacsi
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.