Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Bypassing Struts validator - why doesn't bCancel=true work?

Reply
Thread Tools

Bypassing Struts validator - why doesn't bCancel=true work?

 
 
msa
Guest
Posts: n/a
 
      02-09-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts Validator - creditCard validator smrimell@gmail.com Java 4 02-13-2007 08:32 PM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Struts Validator Eclipse plugin koduru Java 4 07-21-2003 04:11 AM
Struts Validator to validate *optional* date fields? Marcus Leon Java 1 06-30-2003 06:15 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57