• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Strange problem when submitting a form

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone, I'm facing a weird problem every time I try to submit a form... this actually has to do a bit with Javascript, which I'm still not very familiar with. but at least I could make it work.

So the issue is that when I submit the form with at least one of the the checkbox checked, I always get the "isChecked" value as false... since this is what I set on the reset() method.... but this happens only when I submit it by hitting the link button that I made up and put some Javascript stuff in... so, I tried putting a submit button on my JSP it worked just fine... so I'm assuming that this has to do with my Javascript.

Just so you guys know, I'm using Struts.

JSP:



The Form:



This is the Action which I use to get the form values and print them out:

 
Sheriff
Posts: 67641
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts (version 1) has a problem retaining values for checkboxes. Sometimes you have to process the request and extract the named parameters. If you have a debugger, check the request values and look for attributes named by your checkboxes, and the corresponding values.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unchecked checkboxes aren't sent back by the browser--this isn't a Struts-specific issue, that's just the way browsers work.

In any case, I'd first try using the actual form to call submit() on: inside a link tag I'd assume that this would refer to the link, not the form. I could be wrong about that, but as I've done JavaScript form submits forever without any issues I'd start by checking your assumptions.
 
reply
    Bookmark Topic Watch Topic
  • New Topic