Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Anchor tag to submit a form

 
Songezo Nkukwana
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AFAIK you should use "foo.bar.checked = true" to set checkboxes in JavaScript. This isn't really a Struts question, though.
 
Victor Hou
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey David what do you mean by AFAIK ?
 
Songezo Nkukwana
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Viktor: Sorry! AFAIK == As Far As I Know.

@Songezo: I *did* provide a correction.
 
Songezo Nkukwana
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic