This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enabling / disabling forms (Struts)

 
Karl Beowulph
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy.

If I've got the following:



How could I have it so that "fName" is disabled when the value of gender is "male"?

[edited to disable smilies -JM]
[ June 01, 2004: Message edited by: Jason Menard ]
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're asking for the page to change when the user clicks a radio button. You will need javascript to do this.
 
Karl Beowulph
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright, I'll give that a try, thanks.

Any particular URLs you can recommend? I've tried alot of the javascript I've seen on the web and haven't had much success.

A site that has javascript that works with Struts would, of course, be preferential.
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this work?



In addition, I dont think the name attribute is needed, as the tag can be identified by the property attribute.

I think JavaScript for Struts or non-Struts tag is the same, but just the tag attribute name differ, you may check out how to use JavaScript attributes from:
http://jakarta.apache.org/struts/userGuide/struts-html.html

Nick
[ June 01, 2004: Message edited by: Nicholas Cheung ]
 
Karl Beowulph
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works like a charm Nick (minus the space between "on click"), thanks alot.
 
Karl Beowulph
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm... something new has come up that I think is well beyond me.

When I create my .jsp I pre-populate the forms with values from a bean.



That works fine, as does the second_enabled script.

The problem comes when I try to determine, on start up, if the value of "interval" is "weekly" or "biweekly".



This doesn't work. The document.write("I was called "); never shows up.

What makes things odd (for me at least) is that if I change the code to the following:



The document.write("I was called "); now shows up.

I can't imagine why this would be. The only difference between the two is that custID is an integer within the populating DTO and interval is a String.

Both properties do have values within the bean.

Any have any idea why this is?

(on|oad == onload, the forum doesn't seem to like that word)

Edit: semi-colons were appearing in places that aren't in my actual document.
[ June 02, 2004: Message edited by: Karl Beowulph ]
 
Karl Beowulph
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed "interval" to an integer and now it works.

No explanation for how or why though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic