Re: Filling form fields using javascript
by "Data Driven Design" <jeff(at)datadrivendesign.com>
|
| Date: |
Wed, 22 Aug 2001 18:43:59 -0400 |
| To: |
<Reywob(at)aol.com>, <hwg-languages(at)hwg.org> |
| References: |
aol |
| |
todo: View
Thread,
Original
|
|
You can acces them using array notation and the elements array
document.formname.elements["to[0]"].value
etc. There will probably be some trial and error involved.
Data Driven Design
1506 Tuscaloosa Ave
Holly Hill, Florida 32117
http://www.datadrivendesign.com
Phone: (386) 226-8979
Websites That WORK For You
----- Original Message -----
From: <Reywob(at)aol.com>
To: <hwg-languages(at)hwg.org>
Sent: Wednesday, August 22, 2001 3:01 PM
Subject: Filling form fields using javascript
> Hi,
>
> I have the following code, which is supposed to take some values from a
PHP
> script and fill the corresponding form fields with data from an address
book
> ( the addresses are selected in a popup window, and the code below is to
> populate the fields in the main window).
>
> The problem is that the form fields are named to[0], to_email[0]; to[1],
> to_email[1] and so on, and the [ and ] are causing the javascript to
produce
> errors.
>
> How can I get around this problem? I cannnot change the form field names,
so
> have to find some other way of correcting it.
>
> Thanks,
> Peter.
> ___________ THE CODE _____________
> if(window.opener.document.sc_form.to[<?php echo $i; ?>])
> {window.opener.document.sc_form.to[<?php echo $i; ?>].value="<?php
echo
> ($db->f("name")); ?>"};
> if(window.opener.document.sc_form.to_email[<?php echo $i; ?>])
> {window.opener.document.sc_form.to_email[<?php echo $i;
> ?>].value="<?php echo ($db->f("email")); ?>"};
>
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.