Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Trying to autofill form field based on other form field

New Here ,
Jul 27, 2006 Jul 27, 2006
Hey all:

Posted this to general discussion but maybe this is the place for it. Suppose I have a PHP/MySQL setup to where users registering on a website must enter their address. Now I could simply require everyone to enter name, address, city, state, and ZIP code, but that would be a lot of trouble. Instead, I'd like to have them enter name, address, and ZIP code, then have the application look up the ZIP code in another database and enter the city and state accordingly. I'm reading "Dreamweaver 8, the Missing Manual". The author refers to this function (form variables) but states that the function would generally be used on two separate pages, such as a search and result setup. Does anyone know how the "results" can be made to appear dynamically in another field of the form?

Thanks,
Ken Ha Quad
TOPICS
Server side applications
544
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 27, 2006 Jul 27, 2006
LATEST
Same answer as on the other board, in case you missed it:

You will have to pull any information in that you wish to display.

For example, if you wish to auto-fill a state field from a zip code, then
you would need to pull in your recordset for all zip codes (a big one) just
to get this one bit of info (at least I don't know of a way to do it other
than that.)

Then, you'd have to use Javascript or a *client* side programming language
to autofill the field on completion of the other field. For example, if
they
fill in zip code, then you'd need to have a function that is activated
off.focus of the zip code field. This function would have a switch
statement to compare the value in the field with existing values from the
recordset, and then populate the correct info in the state field box.

If you're just pushing data like billing address and shipping address, you
can do that much easier. Just again setup a client side scripting language
that off.Focus will shoot field.value => Other field.value.

HTH,

Jon

"Ken Ha Quad" <webforumsuser@macromedia.com> wrote in message
news:eab8fj$obk$1@forums.macromedia.com...
> Hey all:
>
> Posted this to general discussion but maybe this is the place for it.
> Suppose
> I have a PHP/MySQL setup to where users registering on a website must
> enter
> their address. Now I could simply require everyone to enter name,
> address,
> city, state, and ZIP code, but that would be a lot of trouble. Instead,
> I'd
> like to have them enter name, address, and ZIP code, then have the
> application
> look up the ZIP code in another database and enter the city and state
> accordingly. I'm reading "Dreamweaver 8, the Missing Manual". The author
> refers to this function (form variables) but states that the function
> would
> generally be used on two separate pages, such as a search and result
> setup.
> Does anyone know how the "results" can be made to appear dynamically in
> another
> field of the form?
>
> Thanks,
> Ken Ha Quad
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines