ipjyo
asked on
How do I prompt messages to a user in ASP?
Is there anything I can use to prompt some messages to the user?
suppose if the form has to display some message if the user clicks a submit button without selecting a listbox values.
thanks
suppose if the form has to display some message if the user clicks a submit button without selecting a listbox values.
thanks
With ASP classic you can use client-side scripting - vbscript (MsgBox) or javascript (alert) to do so.
ASKER
I am using classic ASP only.
Well, then either wire your onSubmit event of your form, or have the submit button call a js function for validation, and if it finds a need to get the user's attention, it should call alert('message'); and return false;
ASKER
Actually I hava to call a stored procedure and then print the error message in a text area.
I tried to define a text area and made it disabled on page load.
Then I need to retreive the return value from the stored procedure and print the message accordingly.
So basically I want to print a message using something like response.write I guess.
can I use something like
<TEXTAREA rows=2 cols=20 id=textarea1 name=textarea1>
</TEXTAREA>
<%
Request.Form("textarea1"). Item = "error message"
Response.Write(Request.For m("textare a1").Item)
%>
Thanks for your help
I tried to define a text area and made it disabled on page load.
Then I need to retreive the return value from the stored procedure and print the message accordingly.
So basically I want to print a message using something like response.write I guess.
can I use something like
<TEXTAREA rows=2 cols=20 id=textarea1 name=textarea1>
</TEXTAREA>
<%
Request.Form("textarea1").
Response.Write(Request.For
%>
Thanks for your help
try this,
<%'this code would run on server
strMsg = "Type your message here.."
%>
<script language="vbscript">
'this code would run on client
msgbox "<%=strMsg%>"
</script>
try this
<%
errMsg = "Error msg from Stored Procedure"
%>
<TEXTAREA rows=2 cols=20 id=textarea1 name=textarea1>
<%=errMsg%>
</TEXTAREA>
<%
errMsg = "Error msg from Stored Procedure"
%>
<TEXTAREA rows=2 cols=20 id=textarea1 name=textarea1>
<%=errMsg%>
</TEXTAREA>
ASKER
How do I enable the text area only when an error occurs?
any idea please?
thanks
any idea please?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
when i try the following
<%
errMsg = "Error msg from Stored Procedure"
%>
<TEXTAREA rows=2 cols=20 id=textarea1 name=textarea1>
<%=errMsg%>
</TEXTAREA>
It is printing "0" in the text area
<%
errMsg = "Error msg from Stored Procedure"
%>
<TEXTAREA rows=2 cols=20 id=textarea1 name=textarea1>
<%=errMsg%>
</TEXTAREA>
It is printing "0" in the text area
ASKER
actually when I declared the errMsg in a sub method, it is giving "0"
If I try to declare errMsg in <% %>
it is giving the actual message.
But I need to capture the error code in a method.
How can I modify this?
thanks
If I try to declare errMsg in <% %>
it is giving the actual message.
But I need to capture the error code in a method.
How can I modify this?
thanks
Not clear..
Of so, you can use the built int validators:
Open in new window