This topic is locked

Displaying the Error Info

8/5/2003 4:11:19 PM
ASPRunnerPro General questions
swat author

When ever there is any sql error the page display the error message . however user will not understand really what is the problem. Is there any way that I can just display like this"
Please enter information on this fiels:

Sergey Kornilov admin 8/8/2003

Hi,
if you like to customize default error message - please go to include/..._aspfunction.asp and make required changes to sub ReportError.
Sergey Kornilov

M
MaxLm 8/17/2003

When ever there is any sql error the page display the error message . however user will not understand really what is the problem. Is there any way that I can just display like this"

Please enter information on this fiels:



I agree. Not everyone will understand Bill Gates error codes - Its chaoetic to someone who has not seen those weird stuff. I got puzzled the last few days too.
Looking at the sub reportError may not be the best way to solve this problem. Probably you can setup a errorLIbrary.asp that translates the error into a meaningful page that user will understand. Or, another method will be, a library where we can add text info into it and build the error lib as we progress towards a complete error text libs that will make it easier to understand.
Just like other online form on the market, if required fields are not filled out or validated to be wrong, returns back to the form and point the problem to the user.
thanks.

swat author 8/19/2003

For regarding input validation I guess this will work:
<script language="JavaScript" type="text/javascript">

<!--

function checkform ( form )

{
if (form.email.value == "") {

alert( "Please enter your email address." );

form.email.focus();

return false ;

}

// END

return true ;

}

//-->

</script>

M
MaxLm 8/19/2003

Hello swat:

Thanks,
Do you have a full javascript complement of error validations that I can include?
Like for each field that are required fields. I defined my MDB fields to be required fields and/or can not be Zero. Should there be a javascript for each of these. Maybe we can develop something for Asprunner users?
Thanks,

Max

swat author 8/19/2003

MaxLm,
Make all your DB fields in MS Access (allow to have Zero value) then use this JS to validate your users input ,
Happy Coding <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=465&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />
here is the sample code:
<!-- Paste this code into the HEAD of your HTML document -->
<script LANGUAGE="JavaScript">
<!-- Begin

function checkrequired(which) {

var pass=true;

if (document.images) {

for (i=0;i<which.length;i++) {

var tempobj=which.elements[i];

if (tempobj.name.substring(0,8)=="required") {

if (((tempobj.type=="text"||tempobj.type=="textarea")&&

tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&

tempobj.selectedIndex==0)) {

pass=false;

break;

}

}

}

}

if (!pass) {

shortFieldName=tempobj.name.substring(8,30).toUpperCase();

alert("Please make sure the "+shortFieldName+" field was properly completed.");

return false;

}

else

return true;

}

// End -->

</script>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<center>

<form onSubmit="return checkrequired(this)">
<input type="text" name="requiredname">



<input type="text" name="requiredemail">



<select name="requiredhobby">

<option selected>Pick an option!

<option>1

<option>2

<option>3

</select>



<textarea name="requiredcomments"></textarea>



<input type=submit value="Submit">

</form>

</center>
<!-- The first option in your pulldown menus must be set to 'selected' !! -->

swat author 8/25/2003

This is under aspfunctions.asp page and line 527 or 529 starts with

table to displat errors :
<p align=center><font size=+1>Error happened</font></p>

<table border="0" cellpadding="3" cellspacing="1" width="700" bgcolor="#000000" align="center">

<tr><td bgcolor="#ccccff" colspan=2 align=middle><font size=+1><b>Technical information</b></font></td></tr>

<tr bgcolor="#cccccc"><td width="293" bgcolor="#ccccff"><b>Please Fill Following </b></td><td width="392" align="left"></td></tr>
<%

if Request.Form("Description")= "" then

%>

<tr bgcolor="#cccccc">

<td height="26" bgcolor="#ccccff"><b>Description</b></td>

<td align="left">Text</td>

</tr>

<% end if %>

<%

if Request.Form("Month")= "" then

%>

<tr bgcolor="#cccccc"><td bgcolor="#ccccff"><b>Month</b></td><td align="left"></td></tr>

<% end if %>

</table>
I have this for solution how to display error :
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=497&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />

M
MaxLm 8/26/2003

Hey thanks again. Will try to use this one and see how goes..

swat author 8/26/2003

I have changed my Error page completly and it is very user friendly version... let me know if you need help.
swat

M
MaxLm 8/26/2003

Hey Swat, I do not have a regular HTML page to put the javascripts to. I am using only ASP and gerated by ASP runner. So the pages are the standard _list.asp, _edit.asp. Where shall I put the javascripts? Should it be part of the \includes\jsfunctions or added to the .asp pages.
Lost here.. thanks,

swat author 8/26/2003

This is under aspfunctions.asp page and line 527 or 529 starts with

table to displat errors :
<p align=center><font size=+1>Error happened</font></p>

<table border="0" cellpadding="3" cellspacing="1" width="700" bgcolor="#000000" align="center">

<tr><td bgcolor="#ccccff" colspan=2 align=middle><font size=+1><b>Technical information</b></font></td></tr>

<tr bgcolor="#cccccc"><td width="293" bgcolor="#ccccff"><b>Please Fill Following </b></td><td width="392" align="left"></td></tr>
<%

if Request.Form("Description")= "" then

%>

<tr bgcolor="#cccccc">

<td height="26" bgcolor="#ccccff"><b>Description</b></td>

<td align="left">Text</td>

</tr>

<% end if %>

<%

if Request.Form("Month")= "" then

%>

<tr bgcolor="#cccccc"><td bgcolor="#ccccff"><b>Month</b></td><td align="left"></td></tr>

<% end if %>

</table>
I have this for solution how to display error :
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=518&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />



The code that I have here is not javascript (I know before I told that it is possible to make it with JS) however this is under .........edit.asp page line around 527 - 530 you will see the "ASP ERROR" after that line just edit the rest. what you can do is just delete the messeges after line 527 or 530 then create your own display messege...
Thank you
Swat

M
MaxLm 8/27/2003

Oh I see. I thought the js codes above before that need to be included. Thanks again.