Click to See Complete Forum and Search --> : Multiple save using check box
Hi,
I have a table that displays a bunch of records.Each record is displayed in a row and each row is wrapped in a <form>.
Each row has a mouse over menu with actions like view, edit and validate
I also have check box for each of these rows.At the end of the table I have a save button and a validate button.Please can someone help me save or validate only the rows that have been checked using javascript?
Thanks
Thanks Dave
How do I name the check boxes in each form.Should they all have different names?
Ok, same checkbox names...that's what I guessed.
Couple more questions:
I have 3 buttons in the bottom of the table which are hooked up to 3 different action.
Should I wrap them all in individual forms...or how does that work?I'm not sure
Thanks, dave
Originally posted by mili
Couple more questions:
I have 3 buttons in the bottom of the table which are hooked up to 3 different action.
Should I wrap them all in individual forms...or how does that work?I'm not sure
(Not to butt in, or anything, Dave. Just giving a suggestion, ok? If you want, you can delete me out of this post.)
Mili, if your checkboxes are all named the same, but in different forms, your submit buttons would need to be in the form that corresponds with the checkboxes.
[J]ona
Hey Jona..thanks for your input.
Dave & Jona...I'm all confused now.I dont know how to tackle this problem.Please help me!
All right, say you have three forms. Form1 with 3 checkboxes--all named "chk." Now, you have Form2 with 3 checkboxes--all named "chk," as well. You also have Form3 with 3 checkboxes--all named "chk," like the first two. In each form, you have one submit button. Form1, 3 checkboxes named "chk," and a submit button. Form2 with exactly the same, and Form3 with exactly the same. Thus, if you click the first submit button, it submits form1, but if you click the second one, it submits form 2. The same applies with form3.
[J]ona
Jona, my requirement is different .Here is the basic structure:
<table>
<form>
<tr><td>checkbox</td><td>Menuaction</td><td>values</td></tr>
</form>
<form>
<tr><td>checkbox</td><td>Menuaction</td><td>values</td></tr>
</form>
<form>
<tr><td>checkbox</td><td>Menuaction</td><td>values</td></tr>
</form>
</table>
The reason why I have form for each row is because I have a mouse over 'Menuaction' at each rows which contains two action: edit & view.If I click on edit, it pulls up edit screen for that particular record and view pulls up view details for just that record.
Now, I want to be able to perform mass actions to all these rows with the following buttons:
save, validate & Import
Does this code below make sense? (
check1() is dave's javascript function
<form method="post" action="action1">
<a href="javascript:check1();"><img src="../images/save.GIF" border="0"/></a>
</form>
<form method="post" action="action2">
<a href="javascript:check2();"><img src="../images/validate.GIF" border="0"/></a>
</form>
<form method="post" action="action2">
<a href="javascript:check2();"><img src="../images/import.GIF" border="0"/></a>
</form>
Oh, I see what you're trying to do, in a way. If the first box is checked, do this, if the second, do this, if the third, do this?
[J]ona
oh..no.Sorry I confused you.The checkboxes are only the means for selecting multiple rows.On the checked rows, I should be able to perform any of the 3 actions from the button below.Hope I made it clear
I'd wait for Dave, apparently he has some idea as to what you need... Sorry I couldn't help.
[J]ona
Originally posted by Dave Clark
That's not true, Jona. Strictly speaking, where the submit button resides is immaterial -- don't confused the poor girl by placing restrictions that aren't absolutely necessary.
Perhaps, I wasn't clear. If the submit button is in a different form, how could (and why would) it be used to process a different form's checkboxes.
[J]ona
First of all, pardon my grammar mistake--that should've been a question mark. :D
Anyways, I was more directing to the question as, why would you use, for example, the second form's submit button to submit the first form? (Used a question mark this time.) Obviously, I do not know what Mili is trying to do, I offered help because I thought I had an idea of what she was asking--not so. Sorry for intruding, I'll let you carry on now. ;)
[J]ona
Originally posted by Dave Clark
Mostly, I'd say that using separate FORMs is just matter of style. However, as I mentioned, where multiple actions are concerned... It is a matter of being able to have the form actions hardcoded and have a single (or few) button(s) that can control multiple forms/actions by being able to choose which form/forms to submit.
But then I think of the user, and what his experience with it would be. :rolleyes: I understand. You MAY carry on now. :D
[J]ona ;)
Dave & Jona,
Thanks for your help.My code works now!>
Originally posted by mili
Dave & Jona,
Thanks for your help.My code works now!>
I didn't help--thank Dave. I just confused myself and you (I think). Dave on the other hand, doesn't get confuzzled as easily. :rolleyes:
Sorry. :)
[J]ona