• 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

Enabling / disabling forms (Struts)

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I changed "interval" to an integer and now it works.

No explanation for how or why though.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic