• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

radio button select state

 
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
not sure if this right forum cos it also involves xml+xsl.....
well, I have my data in an xml, and i transform it using xsl and serve the client. Now I have a radio button(group to be precise) in my xsl and Ihave to select one among the group depending on the xml data.
Is there any way to select the radio button state. Let me clear by an example: If I have text field in my xsl.... I set its value this way...

where search is an xml tag. I could not find something similar to this to select my radio button dynamically...
WHat I do now is have a script at form load and in that set the radio button depending on the xml data.
Any pointers?
Regards
[ November 14, 2003: Message edited by: shankar vembu ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are you looking for "checked" which causes the box to be selected?
<input type="radio" checked name="ABC">
or are you asking how to get it from the xml?
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Pascarello:
are you looking for "checked" which causes the box to be selected?
<input type="radio" checked name="ABC">
or are you asking how to get it from the xml?


i cannot use checked this way. my xml to xsl transformer will complain....
i am asking how to set the radio button depending on xml data.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i am asking how to set the radio button depending on xml data.


And you got your answer. Regardless of how your HTML is generated, you are limited to what HTML supports. And the checked attribute is the way that you specofy that a radio element is 'selected'.
Perhaps you might want to express is as the xhtml variant:

to keep any XML formatters happy.
The only alternative would be to emit Javascript that could set the element to 'checked' at page load time.
bear
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
The only alternative would be to emit Javascript that could set the element to 'checked' at page load time.


i do it this way as alread told in my prev post.
I considered using the xhtml option, well i have no other way as u said.
tried

and also

They behave similarly......
This leads to the question what are the possible values this checked attribute can take. well, the above example behaves the same way no matter what value u give for the attribute. btw i tested with IE6 and also NS7.1
Guess i have to stick with my javascript execution on form load. I was just trying to clean up that code, i dint like this functionality in my form load. what if i have a large number of choices and radios. I do this for each one of them ??? no way .....
shankar
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just wanted to add a statement from the source
Some HTML user agents are unable to interpret boolean attributes when these appear in their full (non-minimized) form, as required by XML 1.0. Note this problem doesn't affect user agents compliant with HTML 4. The following attributes are involved: compact, nowrap, ismap, declare, noshade, checked, disabled, readonly, multiple, selected, noresize, defer.
regards
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This leads to the question what are the possible values this checked attribute can take.


This is a weirdness of xhtml (or at keast the way most browsers seem to interpret it). It doesn't matter what the value is.
To make checked be 'false', leave it off. To make it true, include it with any value (including "false").
Conventions I've seen:

I tend to use the former, but perhaps the latter is actually better since the former leads you to believe that you could set it to "false" to turn it off, which is not the case.
bear
 
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic