Solved

How do I populate a series of text fields using Javascript based on a pulldown selection

Posted on 2014-09-05
2
142 Views
Last Modified: 2014-09-10
Head out to http://hihatwebdesign.com/vbs/student_insert.php.

What needs to happen is the user can potential select from a list of families in the "family id" pulldown. If they make a selection, all of the corresponding fields are automatically populated with the info corresponding to the family they selected.

Also, I need a button to appear, should they make a selection, that allows them to clear the info, but only the info effected by the "family id" pulldown (address, city, state, zip, phone, cell, email, alt email, home church, subdivision).

What would the Javascript function look like?

I know I need an "on change" dynamic in the pulldown, but I'm lost as far as how to incorporate a MySQL statement in the midst of the Javascript.

What do you think?
0
Comment
Question by:brucegust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 250 total points
ID: 40306954
for the first one you need to understand ajax and the concept is cascading dropdown
check this threads :
http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28032165.html
http://www.experts-exchange.com/Database/MS-SQL-Server/SQL-Server-2005/Q_28031051.html
http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_24805634.html
http://www.experts-exchange.com/Programming/Languages/Scripting/AJAX/Q_23687497.html
http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_22665347.html
http://www.experts-exchange.com/Software/Internet_Email/Web_Browsers/Q_24994737.html

for your button : <input type="button" id="buttonID" value="reset fields" />
And in head section :
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
jQuery(function($) {
    $("#buttonID").click(function() {
         $("[name='f_last_name'],[name='address'], and so on ,[name='subdivision']").val();
    });
});
</script>

Open in new window

0
 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 250 total points
ID: 40307483
Intro to the basics of jQuery/AJAX, with example showing how to populate a browser document element with information gleaned from the server.
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/A_10712-The-Hello-World-Exercise-with-jQuery-and-PHP.html
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question