M
msa
Hi there,
I'm trying to bypass the Struts validator sometimes on my page. I'm
using JSP and Struts 1.1.
Basically I have a submit button that submits a form. The Struts
validator component is working great for client-side validation of the
contents of this form.
However, now I've been asked to implement a drop down on the page that
repopulates another drop down box when it is changed. Because of the
size of the data, I'm doing this server side, not client side. That
is, I want the page to refresh and then repopulate these fields.
This means I have to bypass the validator to ignore anything the user
might have already entered in the fields. I've read all over the
newsgroups how putting "bCancel=true" in your onclick or onchange
method should do the trick, but it doesn't work for me. When I create
my select box like this
<html:select property="countyId" tabindex="1"
onchange="bCancel=true;document.forms[0].method.value='changeCounty';document.forms[0].target
= '_self';document.forms[0].onsubmit();document.forms[0].submit();">
and then change the drop down box, nothing happens. Control never
gets to my changeCounty action. I've checked that. But I also don't
get any validation messages from the validator, despite there being
validation errors on the page when I change the drop down box. So
it's like the validator function doesn't execute either. (The method
value is there because I'm using a DispatchAction class.)
Is the validation function running or not? How can I bypass the
validation and still submit the form?
Thanks for the help!
Marnie
I'm trying to bypass the Struts validator sometimes on my page. I'm
using JSP and Struts 1.1.
Basically I have a submit button that submits a form. The Struts
validator component is working great for client-side validation of the
contents of this form.
However, now I've been asked to implement a drop down on the page that
repopulates another drop down box when it is changed. Because of the
size of the data, I'm doing this server side, not client side. That
is, I want the page to refresh and then repopulate these fields.
This means I have to bypass the validator to ignore anything the user
might have already entered in the fields. I've read all over the
newsgroups how putting "bCancel=true" in your onclick or onchange
method should do the trick, but it doesn't work for me. When I create
my select box like this
<html:select property="countyId" tabindex="1"
onchange="bCancel=true;document.forms[0].method.value='changeCounty';document.forms[0].target
= '_self';document.forms[0].onsubmit();document.forms[0].submit();">
and then change the drop down box, nothing happens. Control never
gets to my changeCounty action. I've checked that. But I also don't
get any validation messages from the validator, despite there being
validation errors on the page when I change the drop down box. So
it's like the validator function doesn't execute either. (The method
value is there because I'm using a DispatchAction class.)
Is the validation function running or not? How can I bypass the
validation and still submit the form?
Thanks for the help!
Marnie