RE: Validator JavaScript and html:radio buttons

2003-08-26 Thread Yee, Richard K,,DMDCWEST
Matt,
Are you using the Struts html:radio tag to display the radio buttons? If so,
you should initialize the field in the FormBean that contains the value of
the radio button so that Struts marks one of the buttons as 'checked' for
you.

Regards,

Richard


-Original Message-
From: Matt E [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 25, 2003 9:31 AM
To: [EMAIL PROTECTED]
Subject: Validator JavaScript and html:radio buttons


Hi all.  I have two radio buttons on a page, one both
named "outcome" one with the value of "Accepted" and
one with the value of "Rejected".  In my
validation.xml file, I say that outcome is required.

The Javascript checking generated by the Validator
framework doesn't give an error if neither on is
selected, however the backend will, and produce an
error I can see with the  tag.

How do I get the javascript to check the radio buttons
to make sure one is selected?



__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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

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



RE: Validator JavaScript and html:radio buttons

2003-08-26 Thread Cezar Nasui
Hi Matt,

As the other said I would suggest to have one button already selected unless
your business logic says not to suggest something to the user.
I think your generated Javascript doesn't check to see if at least one
button is selected. Can you post the JS code and the code for the submit
button?

>From the top of my head, you should have something like this in your
Javascript code:


function Validation() {
-
if (document.FormName.outcome.value == "") {
alert("Please choose one outcome !")
document.FormName.outcome.focus()
return
}
-
document.FormName.submit()
}


I'm not sure if you should check for ""  or null.

HTH,
Cezar


-Original Message-
From: Matt E [mailto:[EMAIL PROTECTED]
Sent: Monday, August 25, 2003 12:31 PM
To: [EMAIL PROTECTED]
Subject: Validator JavaScript and html:radio buttons


Hi all.  I have two radio buttons on a page, one both
named "outcome" one with the value of "Accepted" and
one with the value of "Rejected".  In my
validation.xml file, I say that outcome is required.

The Javascript checking generated by the Validator
framework doesn't give an error if neither on is
selected, however the backend will, and produce an
error I can see with the  tag.

How do I get the javascript to check the radio buttons
to make sure one is selected?



__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/2003

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/2003


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



RE: Validator JavaScript and html:radio buttons

2003-08-26 Thread Kruse, Matt
> IIRC, it's invalid HTML unless exactly one of the radio 
> button options is selected.  

That's not true. Not really. From the specs:


Radio buttons are like checkboxes except that when several share the same
control name, they are mutually exclusive: when one is switched "on", all
others with the same name are switched "off". The INPUT element is used to
create a radio button control. 
If no radio button in a set sharing the same control name is initially "on",
user agent behavior for choosing which control is initially "on" is
undefined. Note. Since existing implementations handle this case
differently, the current specification differs from RFC 1866 ([RFC1866]
section 8.1.2.4), which states: 

At all times, exactly one of the radio buttons in a set is checked. If none
of the  elements of a set of radio buttons specifies `CHECKED', then
the user agent must check the first radio button of the set initially.

Since user agent behavior differs, authors should ensure that in each set of
radio buttons that one is initially "on".


Authors _should_ pre-check one item, but are not required to.

Since it's not possible in most UI's to set a radio group back to "no items
selected" it's usually bad design to have none selected initially. The user
can't restore the form to its original state if they accidently click in the
wrong place.

I would be able to tell you why the JS is failing if you post the source,
but a better solution might be to re-think your design and consider whether
a group of radio buttons is really the interface you want to use.

Matt Kruse


RE: Validator JavaScript and html:radio buttons

2003-08-25 Thread Wendy Smoak
> The Javascript checking generated by the Validator
> framework doesn't give an error if neither on is
> selected, however the backend will, and produce an
> error I can see with the  tag.

IIRC, it's invalid HTML unless exactly one of the radio button options is
selected.  In your case I'd pre-select whichever value makes sense and
expect the user to change it if they don't like that choice.

No idea about the JavaScript though, sorry!

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University, PA, IRM 



Validator JavaScript and html:radio buttons

2003-08-25 Thread Matt E
Hi all.  I have two radio buttons on a page, one both
named "outcome" one with the value of "Accepted" and
one with the value of "Rejected".  In my
validation.xml file, I say that outcome is required.

The Javascript checking generated by the Validator
framework doesn't give an error if neither on is
selected, however the backend will, and produce an
error I can see with the  tag.

How do I get the javascript to check the radio buttons
to make sure one is selected?



__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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