Page 1 of 1
Prob with Checkbox
Posted: Fri Dec 08, 2006 5:11 am
by tharange
Jcart | Removed image tags because image isn't really neccesary, and we want to be considerate to 56k users
http://mail.cinec.org/FinalUpload/WEBFi ... delete.jpg
I'm in a big trouble, Please help.
Tell me a way to post Checked checkbox's value (under test colom) to another page when I click on DELETE (bottom in black).
Note.. Do not post this.
Code: Select all
<form methord=post..........>
<input type=checkbox name=cb1>
.....
<submit button.........>
</form>
Cos my Checkboxes are unable to gather in to a form tag. Please try to understand the picture.
its an Email box and I need to post checked cb's value and delete messages related to posted cb's value.
thankz
Posted: Fri Dec 08, 2006 8:40 am
by Ollie Saunders
Could you explain more clearly please.
Posted: Fri Dec 08, 2006 9:04 am
by onion2k
1. Rewrite the page so that the checkboxes are all in one form. It's the most sensible approach.
2. Use javascript. getElementsByTagName() is your friend.
Posted: Fri Dec 08, 2006 12:37 pm
by neel_basu
Use Check boxes Like This
Code: Select all
<form name="formname">
.......................................
<input type="checkbox" name="chk_field" value="val1" />
<input type="checkbox" name="chk_field" value="val2" />
......................................
</form>
And Use An Another Hidden Field To Hold The Values of Checked Field
Code: Select all
.................................
<input type="hidden" name="hld_chk_field" value="" />
.......................................
And Execute This Function Just before Posting To Store The Checked Vlaues To That Hidden Field Separated By Comma And Post The Value Of That Hidden Field
Code: Select all
function pass_val()
{
for(i=0;i<=document.formname.chk_field.length;i++)
{
if(document.formname.chk_field[i].checked)
{
var hld_val = document.getElementById("hld_chk_field").value;
hld_val += document.formname.chk_field[i].value + ",";
}
}
}
And If You Cant Put All The Check Boxes In The Same Form Put Each Check Boxes In Different Forms And Dont Give An Name To Those Forms Keep The Same Name For All The Check Boxes Suppose chk_field
Then Execute This Function before Posting
Code: Select all
function pass_val_diff()
{
for(i=0;i<=document.forms.length;i++)
{
if(document.forms[i].chk_field.checked)
{
var hld_val = document.getElementById("hld_chk_field").value;
hld_val += document.forms[i].chk_field.value + ",";
}
}
}
After Post The Data To A Different File To get The Value Of That Hidden Field.
After You Get That Value explod() It To Convert It To an Array.
Posted: Sun Dec 10, 2006 9:53 pm
by tharange
Wow, Thanks man. Thank you all.