I hit a wall with validation in my wizard today.

The Next and Cancel functionality worked fine, validating using automatic validation and forwarding just fine, and canceling when Cancel was clicked. The problem was with the Back button.

As it was a regular Image Submit button it caused the validation to kick in. This was fine if the user had completed that step of the Wizard, but a problem if they hadn't as the Required validation would fail and they would be trapped on the page.

The solution: I created a new version of the Required validator and modified my validator-rules.xml file to use it. It has a short routine that sorts through the available parameters looking for a form parameter with the suffix ".x". The Back button was named "back" so showed up as a parameter called "back.x" and the next button named "next" showed up as a parameter call "next.x".

My code then tested the submitted field for both a value and for the presence of a "next" button click. If "next" isn't present then the validation succeeds as it knows that we want to go back and the Action forwards to the previous page (gee that's a mouthful).

Its probably a bit on the clunky side and could be improved, but for now it seems to work without having to resort to client side Javascript, or anything complex on the server side.

Hope that others might find this useful. If you would like to know more, just drop me an email.

Regards,
Langdon

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to