|
Posted by Jeff North on 12/22/06 07:19
On Fri, 22 Dec 2006 16:02:55 +1000, in alt.php "Vince Morgan"
<vinhar@REMOVEoptusnet.com.au>
<458b74e5$0$23531$afc38c87@news.optusnet.com.au> wrote:
>| > "Moot" <mootmail-googlegroups@yahoo.com> wrote in message
>| > news:1166705949.525973.220510@48g2000cwx.googlegroups.com...
>| > > Johnny Mac wrote:
>| > >> I am trying to make a form that when a user enters data, there will
>| > >> always
>| > >> be one extra line in case the user wants to enter more. Any hints on
>| how
>| > >> to
>| > >> create this?
>| > >>
>| > >> In addition to the tombstone data which should be entered only once,
>| the
>| > >> user has two fields to fill in per line. Once the user has filled in
>| as
>| > >> many lines as necessary, the user sends the data via mailto().
>| > >>
>| > >> help...?
>| > >
>| > > I did this with Javascript pretty easily. Basically I keep an empty
>| > > "template" row hidden, then when the user clicks the "Add Row" button,
>| > > a function clones the template row, modifies the element names (ie:
>| > > "txtName10", "txtName11", etc), then appends the row at the bottom of
>| > > the table.
>| > >
>| >
>| >
>| The OP will need these new inputs to be elements of a form when they are
>| added.
>| As a matter of interest, will the above method, or similar, allow placement
>| of these new elements at the bottom of the form Moot? I only ask as I'm not
>| sure how to do that myself, and will need to know soon enough.
>| Regards,
>| Vince Morgan
I got this code from somewhere awhile back so I can't give the proper
credits.
----------------------------------------------------------------------
<script type="text/javascript">
//Expand form with a new fields if needed.
var nfiles = 0;
function Expand()
{
nfiles++;
if( nfiles < 10 )
{
var adh = "<select name='lbAO" + nfiles + "' ID='lbAO" + nfiles +
"' size='1' id='select'>";
adh += "<option value='AND'>And</option>";
adh += ""<option value='OR'>Or</option>";
adh += "<option value='NOT'>but Not</option>";
adh += "</select> ";
adh += "<input name='tf" + nfiles + "' id='tf" + nfiles + "'
type='text' size='30' maxlength='30' value='' />";
adh += "<br />";
files.insertAdjacentHTML('BeforeEnd',adh);
}
return false;
}
</script>
---html area ----
<input name="Button" type="button" value="Additional Item"
onclick="return(Expand());" />
<div id="files"> </div>
But since this is being returned to php you could substitute
name='lbAO" + nfiles ... with name='lbAO[]"
name='tf" + nfiles ... with name='tf[]"
HTH
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
[Back to original message]
|