This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Anchor tag to submit a form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Anchor tag to submit a form" Watch "Anchor tag to submit a form" New topic
Author

Anchor tag to submit a form

Songezo Nkukwana
Ranch Hand

Joined: Nov 27, 2008
Posts: 51
Hi, i have a tile nav.jsp which has two links...



The form qualsForm a checkbox (mutlibox) which i would like to submit all the checked boxes after i press the above links ... Currently, no data on checkboxes is passed to my Action class .. My form object has a property getCheckedItems which returns an array of checked items .. In my Action class i use this method to get what's checked, and it returns null
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

AFAIK you should use "foo.bar.checked = true" to set checkboxes in JavaScript. This isn't really a Struts question, though.
Victor Hou
Greenhorn

Joined: Dec 16, 2008
Posts: 4
hey David what do you mean by AFAIK ?


Just knowing<br /> <br />I am start Learning English now.
Songezo Nkukwana
Ranch Hand

Joined: Nov 27, 2008
Posts: 51

AFAIK you should use "foo.bar.checked = true" to set checkboxes in JavaScript. This isn't really a Struts question, though.


Seems my question is not clear ... I have to JSP files (Navigation.jsp & QualsForm.jsp) ... QualsForm has checkboxes (multibox) which the user will select.. I will read the selected checkboxes into an array of strings inside the Action class when the form is submitted. If i add a submit button in my QualsForm, the checked boxes gets submitted successfully .. But if i use the hyperlink in Navigation.jsp to submit QualsForm.jsp, the string array form property is always empty ... The code i provided is how i did it was hoping for corrections
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

@Viktor: Sorry! AFAIK == As Far As I Know.

@Songezo: I *did* provide a correction.
Songezo Nkukwana
Ranch Hand

Joined: Nov 27, 2008
Posts: 51
Sorry for my blindness, where's the correction? You only suggested i should check the boxes in Java Script but that's not what i want to do...
 
Consider Paul's rocket mass heater.
 
subject: Anchor tag to submit a form
 
Similar Threads
help pls
Radio Select and Other
Unable to validate form using javascript
jQuery AJAX display issue
how to invoke method based on radio button select