I am having some dififculty with radio buttons. I have inserted them into my JSP page via java script.
<input type = "radio" poperty ="a" value = "b">
<input type = "radio" poperty ="a" value = "c">
When I submit them they are read in the action(using struts) and used to set certain boolens to true or false depending on which radio button is selected, this is done for sort of a permissions page. However, when I load the page all the radio buttons are unchecked. I would like to have them set to the ones previously selected. I could insert if statments to do this but trying to do it right not simply do it. I would also perfer to stay with the javascript as I will be moving away from the struts methodology.
You can't call Java from a JavaScript file: Java is executed on the server; JavaScript is executed on the client (browser) after *all* the Java classes have been run and the JSP has been rendered.
John Lark
Ranch Hand
Joined: Feb 08, 2010
Posts: 67
posted
0
Thats dumb you can do it in ASP!? Okay ill take your word for it I think im just going to try moving towards <html:radio> anyway ty for the help!
Well, you might be a little confused about how ASP works, unless you're talking about the Ajax extensions. Which could be duplicated.
It's not clear to me at all why you're building the radio buttons in JavaScript in the first place, though. You won't be able to build <html:radio> buttons in JavaScript, btw, for the same reason. You can mimic their rendered HTML, but you'll still have to set the value in JavaScript.
Maybe if you were a bit more descriptive in what you're trying to do this would be an easier discussion.
John Lark
Ranch Hand
Joined: Feb 08, 2010
Posts: 67
posted
0
Its a JSP page ! Perhpas I just dont know what im doing lol which is probably most likley *shrugs* got to start somewhere.
Obviously its not "magic" there is no need to be insulting because I dont understand, at one time you didnt. I have inserted .js files into my header before, and used them to hide forms when certain files are selected, and also use them for validation which is understandably different. But surely you could see how that could be confusing?
Thanks,
John Lark
Ranch Hand
Joined: Feb 08, 2010
Posts: 67
posted
0
O for stepping back I probably have partially failed to explain correctly.
what I called Javascript where lines of code I inserted into my JSP page, which isnt java script when you think about it I just interpreted it as such. I think I need to look at it myself some more thanks for trying though guys!