How To Update Selection List Contents From A Server Database Based Upon User Data Entry

Jul 23, 2005

I am trying to create a web page in which the contents of one selection list
depends upon which element in another selection list is chosen, but where
the information to populate the first selection list comves from an SQL
database on the web server.

There are a couple of these situations in my application but, for example,
the first list might be a list of counties, and the second list a list of
states/provinces. Obviously the names of counties depend upon which
state/province is chosen, but there are too many possibilities to be able to
embed them within the web page itself. So when the user selects a
state/province I need to go to the server to ask for the list of counties.

I have seen a number of posts that sort of address this issue. For example
it is suggested to use <script src="a URL"/> to ask the server side code to
send up data of type "text/javascript". However the examples do not seem to
address how the server side code would know which state/province the user
had selected.

If there is a web site that addresses this sort of thing, I would appreciate
any pointers.

View 5 Replies


ADVERTISEMENT

Dynamic Table Contents Based Off Selection Box From A Database

Jul 23, 2005

What I'd like to do is have a dropdown box populated with data from a
database. Based on what you select from the drop down a table will be
generated (in this case a 3 column table) from another query to the
database. I will eventually want a way to select one of the rows from
the table, but for now I'd be happy with just generating the table.

I know it will have to deal with DHTML, dom documents, getElementID,
removeNode, recreating the node. What I am not sure about is how to

1) Dynamically create a table
2) Step 1 with data from a database (recordset)

Like I said, I'd also like to be able to select a row from the table.
I'd be happy with making the ros a radio group, though it would be
interesting to be able to select the row. I take it I'd use CSS to
highlight the row selected then.

View 1 Replies View Related

Update A Dropdown List Based On The Selection Of A Previous List

Aug 16, 2010

i am writing a script that will update a dropdown list based on the selection of a previous list. the script is run by a PHP script, so instead of posting the PHP, i will post an example client-side script. the hierachy is: category, sub category, brand (but sometimes there exists no sub category and the PHP script queries and adds brands instead) everything works correctly, except for one major issue: you can not change the selection of the third (brand) box this could be an easy fix for some coders, but i am not experienced in javascript and could really use some help. here is an example script, sorry it is so long

[Code]...

View 4 Replies View Related

Update Map When New Entry In Database?

Aug 3, 2010

I have a table in a database that gets populated by a client application. Whenever an entry is written to the table I want to fetch the data (which contains the longitude and latitude) and display a marker on Google Maps. I am using the Google Maps Javascript V3 API. Reading the tuples from the database is currently done through a PHP script. How can I update the map each time a tuple is written to the database?

View 1 Replies View Related

Update Selected Option Based On Another Entry

Sep 30, 2011

I have an options list that is generated from a database. It currently has ~125 options in it. I've received the request that the user be able to either enter the corresponding number or select the option from the list. How can I update the "selected" attribute in the options list based on a number that may be entered in another text entry box?

View 4 Replies View Related

Form Mailto Entry On Selection List

Dec 8, 2009

I have created this form. I would like to use javascript to mail the form to the selected email from the selection list when the submit button is pressed.

<form name="Contact Us" id="contact" action="mailto:" method="post">
<fieldset id="selection">
Who would you like to email:
<select>
<option value="email1" >email1</option>
<option value="email2" >email2</option>
<option value="email3">email3</option>
</select>
<fieldset id="Name" >
Name
<input type="text" id="firstname" name="firstname">
E-mail
<input type="text" id="email" name="email">
</fieldset>
<fieldset id="question">
Comments and Questions
<input type="text" id="comment" name="comment" style="width: 500; height: 300">
</fieldset>
</form>

View 4 Replies View Related

Ajax :: Request - Populate A Form With Information From A Database Based On A Textbox Entry

Jun 29, 2011

I'm trying to populate a form with information from a database based on a textbox entry. However, when I begin to key in the textbox I receive "undefined" in each textbox throughout the form.

Take a look at my code for any errors? It also appears that my $_GET['jobid'] is not working properly.

And here is my php:

View 2 Replies View Related

Redirecting To URL Based On User Entry In Form?

Apr 17, 2011

I'm trying to create a form where the user enters data in a field and is redirected to a URL based on that entry - example: user enters 1234 and he is directed to mypage.com/1234/index.htm - if that folder does not exist it would give a 'try again' error.

View 18 Replies View Related

Automate Data Entry (from An Excel Spreadsheet) Into An Online Database

Feb 23, 2011

I'm writing a program that would automate data entry (from an excel spreadsheet) into an online database. I've been doing them one by one for the past couple of weeks...only have about 10,000 left.

View 4 Replies View Related

DropDown List - User Can Select More Than One Entry

Mar 20, 2010

I am having a problem where I want to give user an option to select more entry from one dropdown.

Example:
<form name="form1" method="post" action="">
<label>
<select name="service" id="service">
<option value="service1">service 1</option>
<option value="service2">service2</option>
<option value="service3">service3</option>
<option value="service4">service 4</option>
<option value="service5">srvice5</option>
<option value="service6">service 6</option>
</select>
</label>
</form>

In this case, I want to select service 3, service 4, service 5 and service 6. I don't know how to create a javascript function for this.

View 1 Replies View Related

Update Database When User Print A Webpage?

Mar 18, 2010

I am a newbie in web development. I need to create a function that works whenever user print a web page, I would like to get the date and record that date into database. Additionally, the function must work on IE & Firefox. There is onbeforeprint() event in JavaScript, but that only works in IE.

View 2 Replies View Related

Ajax :: Dynamically Update Contents Of Div Based On Form Fields

Jun 5, 2009

Currently, I have a php form with various inputs, and a div where I am embedding an (initially) empty open flash chart object.Right now, I am calling a php file on the submit of the form, which takes the form data, calls a python script to process the form data, and then creates an open flash chart object using the data the python script returns.There are a few problems with this:

1. When the submit on the form is called, it goes to a different page where the chart is displayed, when I would really just like to update the contents of the chart div where I initially embedded the empty chart.

2. The processing of the form in the python code can take some time, so what I would really like is to have the chart "check" the output of the python script periodically and update the chart each time, adding the new data points to the old ones.

I know I can do all of these things with javascript and Ajax, I just can't seem to find any tutorials or examples that are exactly what I am looking for.

View 3 Replies View Related

JQuery :: Change Contents Of An Overlay Based On Id Pulled From Database?

Aug 11, 2011

I have a page that has a list of companies pulled from a mysql db. Each company name is a link and when clicked an overlay comes up containing further details on that particular company.

Everything is working...my list is created, link pulls up the overlay, but as of now it only populates the info for the company that is the last record. I know I need to pass the record id to the jquery so that it pulls the record for the name clicked, but I am just not familiar enough with jquery to figure it out. I believe I need to pass it to a parameter, but need a nudge in the right direction. Below is my current code with just the basics, I have passed the unique id for each record via mid="<?php echo $member->member_id; ?>"> in the link...I just need to pass that to the overlay. code...

View 2 Replies View Related

AJAX :: Populate An ASP List Box Based On Selection Of A Previous List Box?

Mar 7, 2011

I have 3 ASP list boxes. I would like to populate the second list box based on the selection in the first list box and based on the selection in the second list box, populate the third. I would like to do this using AJAX. How can I do it? Can someone please give me the code snippet as I am a complete noob when it comes to AJAX and I kinda am running outta time to finish implementing it. Additionally, should I use ASP boxes or HTML <select> tag?

View 4 Replies View Related

Form Entry To Time Part Of Database Date Entry?

Aug 1, 2005

I have a textbox on one of my forms that is used to accept a time from the
user. I need to write this value to a database to trigger an event later on.

What I'd like to know is...

Are there any functions in javascript that can convert different time
formats to a known format (24 hour clock)... 5pm -> 17:00 or 5:00 to 05:00,
etc. ???

Assuming that I get the input into a 24 hour format, how can I create a full
time/date variable with todays date and the users entered time?

Finally, if the entered time is earlier than the current time, how can I
create the above date/time combination using tomorrows date?

View 2 Replies View Related

Dynamically Add Textbox For User Entry And Saving Data Entered?

May 5, 2009

I have an ASP page that displays, along with other data, a list of items that refer to a specific element in a database. Instead of adding an Add button, I would like to display a text box below the last item in the list to have the user input any new data. Once they enter the data and hit Enter, the data they enter should then be added to the list and another text box added beneath this item (just as forms and tables in Access do). However, I'm not sure how to implement this functionality.

View 1 Replies View Related

JQuery :: Get Data From A Database And Pre-populatea Form With Appropriate Data For The User?

Jan 3, 2011

I would like to use jQuery to prepopulate a form - ie make a call to a php program to get data from a database and pre-populatea form with appropriate data for the user. Can anyone point me in the right direction for some examples on the simplest way to do this?

View 3 Replies View Related

ERROR: Updating Database Data, Then Update Page Without Reloading?

May 4, 2011

I have a problem, I am by no means new to PHP/Javascript but am finding an error that I cannot ridicule how to stop.Ok Ill try and explain it in simple terms:I have two divs, div1 and div2,In div1 there are links whitch are fetched from the databaseIn div2, content from links href ? in div1 is collected through AJAX.No I have a php preg_replace function that replaces it to look like <a href='#' onclick=\"showTopic(0,$char,'$1');\">$1</a> Now when you click this, it inserts into the "tpm" table in the database,(this table holds the links for div1) But it will not update the links unless i refresh the page? I would like to knoe how to update the links in div1 without refreshing, because refreshing = going back to the start of the code i am working on.

View 3 Replies View Related

Setting Cookie Based On Checkbox Selection By User?

Jul 23, 2005

I've got the following code snippet in a function to set a coockie based on whether or not the user selects a checkbox. Using an alert the cookie text looks fine but when I go to retrieve the values the only one it can find is the value for user. I've a few different things and none of them seem to work. I'm getting the same thing in both IE and Firefox. The only cookie listed is the 'user' with the proper expiration date. Code:

View 1 Replies View Related

TextFields Based On User Selection - Variables And Objects

Apr 10, 2011

I have 3 TextFields, called txtUSD, txtEUR, txtAUS. And a PopupList with the same values, minus the txt part, but I need to form the names of the TextFields to use based on the selection that the user made. So I've done this:

Code:
function btConvert_Click(event){
var amount = document.getElementById("txtAmount").value;
var rates = document.getElementById("lstConvertTo").value;
var from = "txt" + document.getElementById("lstFrom").options[document.getElementById('lstFrom').selectedIndex].text;
var to = "txt" + document.getElementById("lstConvertTo").options[document.getElementById("lstConvertTo").selectedIndex].text;
var curr_from = document.getElementById(from).value;
var curr_to = document.getElementById(to).value;
if(curr_from > curr_to){
amount * rates;
} else {
amount / rates;
} alert(result);
}

But every time I try it I get this error:
Code:
mobile/main.js line 215: Result of expression 'document.getElementById(from)' [null] is not an object.

View 5 Replies View Related

Echo A Variable In A Form Based On User Selection?

Aug 15, 2009

here is part of a form I have:

<select name = "pulmonologist" >
<option selected="" value="">---Select---
<option value="none">None</option>

[code].....

View 1 Replies View Related

Displaying Part Of Form Based On List Box Selection

Mar 13, 2006

I have a form with a drop down list box, few textboxes with labels and submit button. depending upon my selection I should be able to show hide textbox; assume items, 1,3,5 in the selection box shows the items other than the listbox and 2,4,6 items in the selction box if selected hides the labels and textboxes. but in all the case submit button should be present.

View 6 Replies View Related

Show/hide Several Elements Based On List Selection?

Jan 26, 2009

I got a table.Each row has a list of statuses.If status == yes, then several elements will be shown in the rowif status != yes, then hide those elements.Im not sure if I have made a good solution, but it seem to work ok (opera9.6, ff2, ie7)The status selector passes on a unique rowid, and itself. This way the js function can get the row, and the status of the selection. Then toggle various elements in that row.Only annoying thing is the way row elements are named and found. It kinda have to rely on some hard coding, but its ok I guess.Im not sure if its possibel to just call toggle( this ), and that way get to the elements in the row.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

[code].....

View 7 Replies View Related

JQuery :: Color Based On Contents Of Table Data

Oct 13, 2009

I have a table of data brought in through lift and in it is a status column. I am wondering if there is an easy way to color a row based on the contents of that column. Any status of broken was red, edited was yellow and finalized was green. It seems like I could write a widget for doing this, but I don't know how it would work and have little experience with creating my own widgets.

Here is the initialization which includes functions for mouseover color changes.
<script type="text/javascript">
$(document).ready(function() {
// Adds "over" class to rows on mouseover
$(".tablesorter tr").mouseover(function(){
$(this).addClass("rowHover");
});
// Removes "over" class from rows on mouseout
$(".tablesorter tr").mouseout(function(){
$(this).removeClass("rowHover");
});
$('.tablesorter selectThisRow').click(function() {
$(this).parent('tr').addClass('selected');
});
$("#claims").tablesorter({
sortList:[[4,0],[6,0]],
widgets: ['zebra'],
headers: {
0: { sorter: false },
1: { sorter: false },
2: { sorter: false },
3: { sorter: false },
5: { sorter: false },
7: { sorter: false },
8: { sorter: false }
}})
.tablesorterPager({container: $("#pager")});
});
</script>

I'm working with scala and lift as well so I'm bringing in the table data from a database when the page loads. Whether a widget is how to make the colors adjust, or creating more JS functions for doing it.

View 2 Replies View Related

Allow Selection From List If User Select At Least One Checkbox

Apr 14, 2010

How do we use javascript to only allow selection from the list in question 3 to be made IF the user selected at least 1 check box in question 2?
Below is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL]">
<html xmlns="[URL]" xml:lang="en" lang="en">
<head><title> Example </title>
<meta http-equiv="Content-Script-Type" content="text/javascript" />
</head><body><form name="Form"><h1>Survey </h1>
<p> Please take a minute to fill in the form below. </p><ol>
<li> Question 1.</li>
<li> Q2.Which classes have you attended?
<br />
<input type="checkbox" name="attend" id="aerobics" value="aerobics"/>
<label for="aerobics">Aerobics</label>
<br />
<input type="checkbox" name="attend" id="boxing" value="boxing"/>
<label for="boxing">Boxing</label>
<br />
<input type="checkbox" name="attend" id="circuit" value="circuit"/>
<label for="circuit">Circuit Class</label>
<br />
<input type="checkbox" name="attend" id="weight" value="weight"/>
<label for="weight">Weight Training</label>
</li>
<li> Q3. Which of the above classes has been beneficial for you?
(choose one from the list):
<select class="drop" name="dropdown">
<option value="aerobics">Aerobics</option>
<option value="boxing">Boxing</option>
</select></li></ol></form></body></html>

View 1 Replies View Related

Auto-Populate Text Field Based On DropDown List Selection

Dec 3, 2009

I have set up my website quite some time ago that has served its purpose very well, however I will now be adding an order form functionality. So far, by reading books and traversing forums, I have been able to develop a page where the user
1.Enters data into the required fields, that is then submitted to a MYSQL database via PHP,
2.Can retrieve orders that are stored in the database,
3.Delete orders that are stored in the database.

I have wamp installed on my computer as the webserver. I have also incorporated two drop down lists that both retrieve their values from tables within the database. The first drop down list retrieves the Australian States that I have stored in a table, and once the submit button is pressed, it stores the State that is selected to a separate table. This drop down list functions as it should. An extract from "From Place an order.php"

<?php
$dbcnx = @mysql_connect('localhost', 'root', 'tingling');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
} .....

The second drop down list retrieves product names from a table that contains products and their prices. What I would like to happen, is that when the product is selected from this drop down list, a text box is automatically filled with its corresponding price. I had this drop down list working as per the "States" drop down list, but could not get it to auto populate the text field. I got some assistance from a friend and was able to get the text box to auto populate with its corresponding price, however when the page was submitted to the database, the "id" number of the product name from the drop down list was stored, and not the product name.

<select name="productSelection" onchange = "getProductDetails(this)">
<option selected value="1product">Select Product</option>
<?php
$products1 = @mysql_query('SELECT * FROM products');
if (!$products1) {
exit('<p>Unable to obtain author list from the database.</p>'); .....

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved