...

View Full Version : Help splitting values between seperate forms



DataTalk
12-20-2010, 06:05 AM
I am trying to split the (id) values between seperate forms
and the submit buttons are not located between the form tags.

Note:
->The 3 forms are located at the top of page
->the (3) Submit buttons are in a query and are outside the form tags.
->In this case it does not make sense to have the form duplicating itself in the sql_query.

need the correct code for the 3 script functions var form1, form2, form3
then i need the correct function submit code something like -> onClick='Split(this.form1,1)'

Also: To keep this simple could the 3 scripts be combined into one?



<!-- SPLIT VALUES BETWEEN SEPERATE FORMS -->

<script type="text/javascript">
function Add(sel,first)
{
if (sel.selectedIndex == 0 ) return;
var temp = sel.id.split(",");
sel.form1["F"+first].value = temp[0];
sel.form1["F"+(first+1)].value = temp[1];
}
</script>

<script type="text/javascript">
function Edit(sel,first)
{
if (sel.selectedIndex == 0 ) return;
var temp = sel.id.split(",");
sel.form2["F"+first].value = temp[0];
sel.form2["F"+(first+1)].value = temp[1];
}
</script>

<script type="text/javascript">
function Delete(sel,first)
{
if (sel.selectedIndex == 0 ) return;
var temp = sel.id.split(",");
sel.form3"F"+first].value = temp[0];
sel.form3["F"+(first+1)].value = temp[1];
}
</script>

<form method='post' name='form1' action='record_add.php'>
<input type='hidden' id='F1' name='t101' value='' >
<input type='hidden' id='F2' name='t102' value='' >
</form>

<form method='post' name='form2' action='record_edit.php'>
<input type='hidden' id='F3' name='t103' value='' >
<input type='hidden' id='F4' name='t104' value='' >
</form>

<form method='post' name='form3' action='record_delete.php'>
<input type='hidden' id='F5' name='t103' value='' >
<input type='hidden' id='F6' name='t106' value='' >
</form>


<!-- NOTE: THE SUBMIT BUTTONS ARE IN A QUERY OUTSIDE THE FORM TAGS AND NEED TO TARGET THE PROPER FORM1,2,3 onClick -->
<button type='submit' id='$mytable,$columns[Field]' onClick='Split(this.form1,1)'>
<button type='submit' id='$mytable,$columns[Field]' onClick='Split(this.form2,3)'>
<button type='submit' id='$mytable,$columns[Field]' onClick='Split(this.form3,5)'>

Old Pedant
12-20-2010, 10:44 PM
NOTE: THE SUBMIT BUTTONS ARE IN A QUERY

What is a "query" in your parlance????

What language is this using on the server??? PHP or something else?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum