Hi DN! Seems like the specs just changed..;) Please see inline
comments..
Dinh Nguyen wrote:
> Geeta,
>
> thanks for pointing out the issue, however, we take care of that in
> the validation form. Either way if the user misses some fields,
> he/she'll be redirected back to the registration form asks them to
> fill-in the required fields.
> I am sorry I was confusing myself too: Below is the instructions:
>
> 1) Fill-out the registration form
> 2) Click on Submit button on registration form
> 3) User is redirected to Confirmation page "Your information is
> submitted"
What is the purpose of this confirmation page? Is this just a display of
what the user has just entered and asking the user if it is ok to submit
now? If the user is happy with the input, (s)he is supposed to click on a
"Done" button and if not, (s)he clicks on a "Cancel" button. Is this
correct? If so, forget about the Javascript, use ordinary Actions to
direct the user to the correct place. and you can just use the
<html:cancel tag for the CAnel button. (I think this was suggested by an
earlier post by Rajat Pandit..?) . I am no longer sure where you ran into
trouble in the first place..?
>
> 4) On confirmation page, the user clicks "Done" button
> 5) Redirects to index.jsp
I assume the user is redirected to index.jsp only if there are no errors?
and you are using the form bean validate for checking input errors and so
on. What do you mean to do if there are no input errors but for some
reason the registration is a failure (as in database is done etc.?)
>
>
> On the registration form (register.jsp) I code like this:
>
> <head>
> <script language="JavaScript">
> function confirmSubmit(){
> if (confirm("are you sure you want to submit
> information?") {
> window.location.href ="<html:rewrite
> page="/register.do" />";
> }
> } //end method confirmPrint
> </script>
> </head>
>
> <html:errors/>
> <html:form action="/register" focus="userName">
> ....
>
> <html:submit value="Submit" onclick="return confirmSubmit()" />
> .....
> When I filled out (correctly) the form, click on submit button, then
> it took me directly to register.do page. ????
This is wierd. Seems like your onClick method isn't working correctly.
Have you looked at the source of the regisration page? Have you checked
for javascript errors? You could change you confirmSubmit() function so
that all it does is throw an alert so that you know that onClick is
working if you really want to dig into this. On the other hand, if your
specs are such that (as I suspect) Javascript will not even be needed any
more, maybe you can do away with this whole code anyway..
>
> I guess that there is some logics behind this, but I don't know.
>
> Thanks,
> DN
Regards,
Geeta