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

CF8 & AJAX to populate form fields

New Here ,
May 15, 2008 May 15, 2008
First - I apologize if I am posting in the wrong area. This is my first post and I am learning.

Second - any and all help/info is greatly appreciated

Now for my question...
Everyone is talking about AJAX as a way to populate select lists based on what is 'selected' from another list. My question is can this same concept be used to populate form fields?

Case in point:
A user is presented with a select list of user names; upon selecting a user name, form fields for
1. Title
2. Phone
3. Email
etc etc need to be populated without refreshing the page.

Originally, it was thought we could bring all the "user data" in when the page initially loads, however, our user list has grown to over 4500 and is updated almost daily. So bringing all that data in is REALLY slowing things down.

The idea now is to create the user select list using only the user_id and user_fullname and upon change using the user_id to make a call back to the DB to get user data (title, phone, email etc).

Can this be done with AJAX? Would using AJAX be the best way to go?

Any suggestions??

Thank you...
TOPICS
Getting started
390
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 ,
May 15, 2008 May 15, 2008
I'd use a different approach altogether. I wouldn't ask anyone to make a single selection from a list of 4500 names. I'd offer a text box and ask for part of the username. Then I present the matching records. They could select the one they want and that's when I'd populate the form fields.

If the initial search resulted in exactly one match, I'd use cflocation to get to the page with the form instead of presenting that single record to the user.
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
New Here ,
May 15, 2008 May 15, 2008
Thanks for the sugesstion and that might be another way to go, but ultimately, I am trying to determine if at some point it makes sense or would even work to populate the additional form fields I spoke of...using AJAX.

To clarify, the examples I have found have dealt with select lists being controlled by other select lists. I am trying to determine if it would both be practical and make sense to use AJAX to populate form fields instead of a select list.

Or am I misunderstanding your comment "They could select the one they want and that's when I'd populate the form fields"...do you mean you would use AJAX at that point??

Thanks again
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 ,
May 15, 2008 May 15, 2008
I don't have access to ajax. I use version 7 of cold fusion. As long as you populate the form fields, what difference does it make whether or not you use ajax?
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 ,
May 15, 2008 May 15, 2008
as Dan is suggesting, use what is usually called 'autosuggest' to help
users find the user they want by letting them type in first 2-3
characters of the name and showing them a short list of users with names
starting with those characters, instead of having them scr0ll through
4500 list items to select a user.

after that you do not really need to use ajax to populate your form
fields - instead have a form in a different page and relocate the user
to that page passing the id of user selected in the autosuggest list.
this is easier than using ajax to populate various form fields, though
if you are on cf8 it is fairly trivial, too with data bindings or cf
javascript proxies. it all in the docs if you need more info...

hth


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
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
New Here ,
May 16, 2008 May 16, 2008
LATEST
Thanks to both of you for the input & information.
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
Resources