mas7357
Posts: 29
|
| Posted: 02/19/2007, 3:21 AM |
|
Has anybody managed to make the error messages kept in {errror} appear in a popup on form validation. I would be very grateful if somebody could help as the users of my pages (for a local swimming club) keep on ignoring the errors reported at the top of the form
_________________
MikeS |
 |
 |
CCT
Posts: 44
|
| Posted: 02/19/2007, 9:22 AM |
|
You could try implementing some Client-Side validation before form submission.
Alternatively you could display alert on page postback (when validation error occurs). To do this, modify your error block like this:
<!-- BEGIN Error -->
<tr class="Error">
<td colspan="2">{Error}</td>
</tr>
<script type="text/javascript" language="JavaScript">
alert("{Error}");
</script>
<!-- END Error -->
Note added script block. You can also display usual popup window (with window.open) instead of alert and write error text to it with opendedWindow.document.write("{Error}")
_________________
Get more CodeCharge Studio builders at http://codechargetools.com |
 |
 |
MikeS
|
| Posted: 02/19/2007, 9:44 AM |
|
Thanks so much - sorry to show my lack of understanding , but where do I find my error block?
|
|
|
 |
MikeS
|
| Posted: 02/19/2007, 10:12 AM |
|
I found the error block and inserted the javascript and it works-well sort of. The original page disappears when the alert box appears (which is OK) but the error message is rather difficult to read as it is in the form of
error message<br>error message<br>etc
Is there a way of formatting the error messages before display
Thanks again for your time- I am nearly there ....sooooo close.....
|
|
|
 |
CCT
Posts: 44
|
| Posted: 02/20/2007, 1:34 AM |
|
var errorHtml = "{Error}";
alert(errorHtml.replace('<br>', '\n'));
_________________
Get more CodeCharge Studio builders at http://codechargetools.com |
 |
 |
MikeS
|
| Posted: 02/20/2007, 3:06 AM |
|
Thanks,- this is very close but only replaces the first <br> tag and not the others (when there is multiple concatenated messages. Again this is so close.....Please bear with me! I can almost taste success
|
|
|
 |
CCT
Posts: 44
|
| Posted: 02/20/2007, 5:36 AM |
|
var errorHtml = "{Error}";
alert(errorHtml.replace(/<br>/ig, '\n'));
_________________
Get more CodeCharge Studio builders at http://codechargetools.com |
 |
 |
MikeS
|
| Posted: 02/20/2007, 7:51 AM |
|
Yessssss! Thanks very much, it now works- I hope the club members appreciate it
|
|
|
 |