button

Hello all...

I have my code something like his:

<label for="btn></label>

<input type="button" id="btn" name="btn" value="Add" onclick="javascript:showButton('id');"/>

<div>

<div id="id" style="display: none;">

<input type="text" id="txt" name="txt" maxlength="5" />

</div>

so when the page first loads up, i have this text box hidden ...

but when the add button is clicked I have to show the text box...and I'm doing this using javascript...

and if the button is clicked I need to check for null or emtpy for the text box and throw an error if it is null or empty ...

but if the button is not clicked I can the skip the check for null in my action class...

My question is how can i know whether new is clicked or not since it is of type button...I can't use submit because i already have a submit button ...this add button is only to add a name in the text box...

Help is greatly appreciated...

Thanks,

Greeshma

[1054 byte] By [Greeshma12a] at [2007-11-27 6:20:42]
# 1

It sounds like you might be confusing Java and Javascript. The two languages are only vaguely similar. You may want to direct your question to a [url=http://forums.devshed.com/f115/s]Javascript Forum[/url].

[EDIT] Wait a tic... You have ~fifty-five posts here so far. You should know better.

~

yawmarka at 2007-7-12 17:36:18 > top of Java-index,Java Essentials,Java Programming...
# 2
Thanks for your quick reply...I'm not confused between java & javascript...I just want to know how can i know whether the 'add' button is clicked or not...
Greeshma12a at 2007-7-12 17:36:18 > top of Java-index,Java Essentials,Java Programming...
# 3
> I'm not confused between java & javascript...I just> want to know how can i know whether the 'add' button> is clicked or not...Where do you want this check to occur?~
yawmarka at 2007-7-12 17:36:18 > top of Java-index,Java Essentials,Java Programming...
# 4
Thanks again for your reply...In my action class....
Greeshma12a at 2007-7-12 17:36:18 > top of Java-index,Java Essentials,Java Programming...
# 5

Oh, I think I see what you're asking; sorry for the confusion. If the text box is displayed, a user is required to fill something out, right? Well, the server needs to know about this state, so you'll need to send that information along in the request. Perhaps you can use JavaScript to populate a hidden field (e.g., name="add" with a value of true or false, or some such thing) that lets the server know if the user selected that option.

~

yawmarka at 2007-7-12 17:36:18 > top of Java-index,Java Essentials,Java Programming...
# 6
Thank You ...I have the same thing in mind but was not sure whether this functionality is 508 compliant ......Greeshma
Greeshma12a at 2007-7-12 17:36:18 > top of Java-index,Java Essentials,Java Programming...
# 7
> I have the same thing in mind but was not sure whether this functionality is 508 compliant...I'm sorry, but I wouldn't be of any help with that. I'd be curious to know what you found out, though. Cheers!:o)
yawmarka at 2007-7-12 17:36:19 > top of Java-index,Java Essentials,Java Programming...