• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to call action on click of checkbox?

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how to call action on click of checkbox?

here is my code:


i tried the following ways, but none works:

added onclick="test()" argument to checkbox tag. test() is a method defined inside action class.

then i try value="test()"

i am not getting any other clue to do it. please suggest me a way to achieve it. thanks
 
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
...

Use a JavaScript onclick handler?

What are you actually trying to accomplish?
 
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use javascript event method onclick on the checkbox and call the funtion that could submit the form.

e,g,

onclick="submitForm()";

then in the submitForm method.

Submit the form e.g. document.myform.submit();
 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks neweton and siva, i tried document.HelloWorld.submit() in javascript function and it works.

i have a hierarchical list of checkbox items. on click of the checkboxes, i need to update some data into the database and reload the screen.

alternatively, i could have a save button. on click of save button all the changes done in the screen will be saved. the problem with this approach is that i need to maintain the current state into some local variable on page. and also i am using extensive DOM unblock and none style on the screens. so, i found it difficult to keep track of current state of the page.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic