Calvin Day
asked on
If (CheckBox not Checked) then?
User clicks next button;
If (CheckBox not Checked) then
Message;
Return
Got HTML or script for this?
If script preferably VB or perl.
Thanx in advance,
Greg
If (CheckBox not Checked) then
Message;
Return
Got HTML or script for this?
If script preferably VB or perl.
Thanx in advance,
Greg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hmm, I have a Java servlet example. But I don't know what the corresponding VB or Perl would be. In Java:
-------------
public boolean validate( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException {
if( request.getParameter( "CHECKBOXNAME" ) != null &&
request.getParameter( "CHECKBOXNAME" ).equals( "Yes" ) ) {
request.setAttribute( "agreed", "true" );
request.getRequestDispatch er( "ERRORPAGE" ).forward( request, response );
}
else {
request.setAttribute( "errorMsg", "To continue, you must check the checkbox!" );
request.getRequestDispatch er( "ERRORPAGE" ).forward( request, response );
}
}
-------------
I've only done a limited amout of work with Perl. I know that I have some sample code at home that I wrote about a year ago that would probably remind me of what I'd need to know to answer this. If you haven't received a better solution within a few more hours, I'll see if I can drag it up.
-corey
-------------
public boolean validate( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException {
if( request.getParameter( "CHECKBOXNAME" ) != null &&
request.getParameter( "CHECKBOXNAME" ).equals( "Yes" ) ) {
request.setAttribute( "agreed", "true" );
request.getRequestDispatch
}
else {
request.setAttribute( "errorMsg", "To continue, you must check the checkbox!" );
request.getRequestDispatch
}
}
-------------
I've only done a limited amout of work with Perl. I know that I have some sample code at home that I wrote about a year ago that would probably remind me of what I'd need to know to answer this. If you haven't received a better solution within a few more hours, I'll see if I can drag it up.
-corey
You'd have to do it on the client anyway. The message can only be shown if the script is loaded at the client so the best bet is coreyit's first example.
CJ
CJ
ASKER
Thanx everybody.
Thanx CJ for your comment.
I program in Delphi, dabble with HTML, etc....
Thanx CJ for your comment.
I program in Delphi, dabble with HTML, etc....
Oh, I disagree with CJ's comment in this case (not often though). For a server side solution, which is much more reliable, you would essentially generate the page with an error message in it. I know you can do this with Perl, php, etc. as well. But sticking to my Java/JSP example, you would have your agreement page attempt to find a request attribute called errorMsg. If it is found, it's displayed on the web page.
I just found my old Perl stuff. If you like I can try to come up with a comparable example in Perl.
-corey
I just found my old Perl stuff. If you like I can try to come up with a comparable example in Perl.
-corey
ASKER
I just what to be sure the user has read and accepts our subscriber service agreement before continuing.
Thanx for the prompt response,
Greg