• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

make javascript form accesible

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a table with ten rows, for example. The table has three columns and the first one has a checkbox per row. So, you can select one or more rows by checking the corresponding checkbox. Then you have three buttons, each of them to do a different action with the rows selected.
The table and buttons are surrounded by a form. But what i want is to submit to a different location when each button is clicked.
What I do now is to have an onclick event on the buttons and then with Javascript I change the action attribute of the <form> tag.
But I want to make it accesible, I mean, that if someone disables Javascript, that the form still works. Any ideas?

Thanks in advance
Jorge
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to handle it on the server than. No other option. Look to see what button was clicked in the form submission.

Eric
 
Jorge Blaz
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Pascarello:
You have to handle it on the server than. No other option. Look to see what button was clicked in the form submission.

Eric



Thanks Eric :-)

I have done it the way you say. Since I'm using Struts i used an Action who looks which buttons was clicked and then link to the appropiate page.
But I still have one problem.

I have some hiddens that are set when each button is pressed. These hiddens are different from one button to the other. That means, if i click button1, the hiddens are sent with some values. When I click button2, these hiddens are sent with other values (i sent them with javascript-onclick event).

No, if i do the button-clicked check on the server, I don't know how can i send the related hidden values to the clicked button.

I could have the same hiddens repeated with different names for each button, and then sent all of them, the ones related to the clicked button will have been populated with values and all the others will be sent blank. But I don't really like this solution. Maybe you can point me to other ideas.

Thanks a lot
Jorge
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic