WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder



Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : How to populate an input field of type text from a select box with JavaScript.
Categories : Java Script
Boaz Yahav
Date : Aug 23rd 2001
Grade : 4 of 5 (graded 4 times)
Viewed : 11891
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Boaz Yahav
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

Sometimes you need to allow users to choose a value from a select box (pull down menu) and
have the value they chose show up in another input field of type text (for example).

Here is how to do it :

Add this Jscript function to your page.


<SCRIPT LANGUAGE="JavaScript">
function UpdateField(index) {
form=document.FormName;
form.TextFieldName.value = form.SelectFieldName.options[index].text
}
</SCRIPT>


o FormName is the name of your <FORM>

o TextFieldName is the name of the field you want the Selected text to be in.

o SelectFieldName is the name of the Select field you are choosing from.



The call to the function should be like this :


<SELECT onChange="UpdateField(this.selectedIndex)"; NAME="SelectFieldName">

In case you want the value of the field and not the text that is shown in the pull down menu,
all you need to change is the next line in the function :

form.TextFieldName.value = form.SelectFieldName.options[index].text

to

form.TextFieldName.value = form.SelectFieldName.options[index].value



Table editable dynamic form with edit + selection (select / option) + checkbox.
Categories : Java Script, DHTML, User Interface, CSS, HTML
Dynamic Calendar in PHP, Javascript and HTML.
Categories : PHP, Java Script, HTML and PHP, Calendar
Java Script which implements a Clock (Client Side)
Categories : Java Script, Date Time
complete simply working javascript password generator file. Use letter, vowels, consonants (uppercase and lowercase) arrays to create a really random and secure password. improved security using time functions to initialize random number generator.
Categories : Java Script, HTML, Security, Authentication, Strings
The toll booth
Categories : PHP, Java Script, Filesystem
MD5 secured login
Categories : PHP, Java Script, Authentication, Security
Javascript URL and Email Validation
Categories : Java Script, Data Validation, Form Processing, Email, URLs
Builds JavaScript that updates the contents of one selector based on another.
Categories : HTML, Java Script, PHP, Complete Programs, General
Activate an Ajax.Autocompleter with an onLoad Command
Categories : Java Script, AJAX
KuPro1.0 - This application is for Libraries, To see their books and to maintain users books. This version is in Turkish, future vers may have English Support.
Categories : PHP, Java Script, DHTML
Dynamic generation of textboxes, select items etc in a table for use with databases applications, matrimonials and for job sites
Categories : PHP, HTML and PHP, Java Script
day and week grid with clickable fields on/off and possibility to insert in DB
Categories : PHP, Java Script, CSS
How to display a PHP variable value from a selectbox without reloading the page by merging PHP and Javascript variables.
Categories : PHP, Java Script, Variables
Form Processing : with alert Highlight field name which is not filled by user
Categories : Java Script, Form Processing, Data Validation, Beginner Guides, Web Design
This is a script that list all image files on a given directory, and displays the thumbnails nicely formated within an HTML table. It also make use of JavScript to open pop up windows when the users want to see the full photo.
Categories : Graphics, PHP, Complete Programs, Java Script