permaculture playing cards*
The moose likes HTML, CSS and JavaScript and the fly likes I want to enable submit button only when i check the checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "I want to enable submit button only when i check the checkbox " Watch "I want to enable submit button only when i check the checkbox " New topic
Author

I want to enable submit button only when i check the checkbox

rahul jadeja
Greenhorn

Joined: Oct 15, 2009
Posts: 11
Hey people
I want to enable my submit button only when the checkbox is checked..
Can you please tell me what modifications i have to do in <html:checkbox ......
and what all files do i have to change
I am new to struts
please help
thanks
nobeltr ozgur
Greenhorn

Joined: Sep 20, 2009
Posts: 14
you have to use javascript
rahul jadeja
Greenhorn

Joined: Oct 15, 2009
Posts: 11
Hi thanks for the reply
this is my checkbox..its in the jsp file
<html:checkbox property="receiveEmail"/><bean:message key="receiveEmail.label"/>
and the next part of the code is validation.xml
<field property="receiveEmail" depends="required, validwhen">
<arg0 name="test" key="receiveEmail.label"/>
<var>
<var-name>test</var-name>
<var-value>(*this* == "true")</var-value>
</var>
</field>

can you please help me in which file should i make changes and how
thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

This isn't a validation issue, it's a JavaScript issue. You need to write a JavaScript function that enables the submit button after the checkbox is checked.
rahul jadeja
Greenhorn

Joined: Oct 15, 2009
Posts: 11
thanks for the reply..can you please help me out with the javascript code..also that in which file do i have to put that code or do i have to make a new javascript file
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I want to enable submit button only when i check the checkbox