troubleshooting Question

Enabling/Disabling form elements with Struts 2 tags

Avatar of Reddoxx
Reddoxx asked on
Java EEJScriptHTML
5 Comments1 Solution8041 ViewsLast Modified:
I'm trying to make a script to enable a Submit button (disabled by default) inside a <s:form> tag. This would be achieved by selecting two different radio buttons (iterated and displayed with the Display tag library in 2 different tables)  and selecting a choice other than the default one from a drop down list.

I've been able to implement scripts to do this using the standard HTML form tag but referencing the <s:form> doesn't work (it throws an error saying that it can't find the element). I'm trying to do something in the style of 'document.formName.sendData.disabled=false;' but i keep getting this error. The same happens when I use  'document.forms[0].sendData.disabled=false;'
Switching to other method like  'document.getElementById('sendData').disabled(false);' doesn't throw this error but it doesn't seem to work.

I'm calling to the function from the iterated radio buttons (printed as <input type="radio" ...> by iterating a list via Displaytag) and from the drop down menu (as a <s:select ...> type), and calling to the function using 'onClick="functionChecked()"'. Also I'm trying to make it work both on Firefox and IE6.

Any idea on how to do this? any suggestion that works even for a single group of radio buttons would be great (since I haven't been able to even make that work, and I could go from there for the rest. Thanks in advance.
ASKER CERTIFIED SOLUTION
Gurvinder Pal Singh

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros