JQuery :: Replace Dots And Commas In A Field And Then Use That Value To Auto Populate Another Field?

Oct 27, 2010

I'm using Google Maps to calculate distance between cities. I need to use that distance value for some basic calculations. Distance has to be in "Angloamerican" format (1,234.00) but in metric system. So, Google Maps answer for Madrid - Berlin query will be one of these two:

a) <span jscontent="distance['text']" jsdisplay="distance" jstcache="7">2.320,1 km</span>
b) <span jscontent="distance.text" jstcache="23">2.320,1 km</span>

notice the differences in span "classes" (jstcache is 7 or 23) and lack of any "id" or "name" attributes.

What I want to accomplish is:

1) Convert these Google Maps distance values to "Angloamerican" format (2,320 km) or (even better) format without thousands separator which would only use dots as decimal separator (2320.1 km)

2) Use that filtered value to populate a text field called distance

Populate hidden form element value with the value of a text field on form submit (jQuery)

It helped me a bit with the auto-populate part, but I can't make it work in combination with this Google Maps code. Here is my current code:

<head>
...
<script type="text/javascript">
function submitMyForm(){

[Code]....

View 3 Replies


ADVERTISEMENT

Auto Text Field Populate Based On Dropdown

Feb 22, 2011

I've looked around and from what I can tell, the code seems right. Basically crating a JS array and passing PHP values to it to use in an onChange to fill a text field. The dropdown gets populated fine but the text field does not autopopulate onChange. I'm not too fluent with JS but have a good analytical mind and from what I can see, the logic seems right.

<?php
include('connectdb.php');
$CENTRE = $_SESSION['centreAFB'];
$qryFormList = mysql_query("SELECT * FROM tblLogin WHERE ACCT_TYPE = '2' AND loginCENTRE = '$CENTRE' ORDER BY loginNOM");
echo "<script type='text/javascript'> var formCourriel = new Array()";
while($resFormList = mysql_fetch_assoc($qryFormList))
[Code]....

View 7 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

Accept Both Dots And Commas In Calculator?

Aug 2, 2010

I want to accept both commas and dots in my calculator. How to do this?

function compute(form)
{
get Index value for width
var wt = (form.width.options.selectedIndex)

[Code]....

View 6 Replies View Related

JQuery :: Strip Out All Of The Commas In Numeric Text Field

Sep 29, 2009

I would like to strip out all of the commas in numeric text field called test on blur. New to jQuery. I have had a go at coding would it work? $('input#test').val($('input#test').val().replace(/,/g,'')); and ....... how do i calll it?

View 10 Replies View Related

Validate Email Field For Commas?

Feb 10, 2011

I have an expression validating email addresses but it seems there is a loophole. If a user enters a comma this is accepted. how i can modify the following to disallow commas?

validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
strEmail = document.form1.df_email1.value;
if (strEmail.search(validRegExp) == -1) {

[code].....

View 17 Replies View Related

How To Use A Field Value To Auto Fill Other Field Values

Sep 17, 2009

Not exactly sure this is the right forum to post this but just to give it a shot.I am relatively new to programmming...I am currently working on a web appliation using MySQL DB and use PHP/SQL.I have a web form i have created. What i want to achieve is that when a user fills in one of the fields...a text field, i want 8 other fields to be AUTO filled with different values related to the one the user filled in

View 2 Replies View Related

JQuery :: Populate The Value Field In A Form?

Jun 4, 2011

Here is my Script

$(function() {
$.ajax({
url: "includes/mysql2xml.php",
dataType: "xml",

[Code]....

The xml is valid and I can autocomplete on the names and it fills out the form on the screen with the names of the contact. What I need to do is add the value"" of the input so that it will go into my mysql table when I submit the form.

View 2 Replies View Related

JQuery :: Populate One Field From Contents Of Another As It's Being Entered?

Jul 27, 2010

As the user types the "start year", I want to fill the "end year" with the same value, keystroke by keystroke. But simply using a keypress eventhandler doesn't do quite what I want, as

$("#start_year").keypress(function(event) {
$("#end_year").val($("#start_year").val());
})

fills in "end_year" with the value before the keypress has been added to "start_year".Again, I just want "end_year" to be the same as "start_year" as it's being typed.

View 2 Replies View Related

JQuery :: Populate Select Form Field?

Jan 26, 2010

I have a form where a user may select a box from above which will query the database and autofill in the fields. This works properly for all of my input text fields but I have a select box where a user selects their state that I am unable to get to properly populate.

The select box is populated on page load in the following format....

<select id="state" name="state">
<option value="1">ALABAMA</option>
<option value="2">ALASKA</option>
</select>

[Code]....

Everything populates correctly except where I try to set the val on the state select field. It does not change at all. I need it to display the statename with the value of the state (number).

View 1 Replies View Related

JQuery :: Populate Hidden Field When Click On A Link?

Oct 23, 2010

I am using multiple links at the same page with same class(cannot access using id because of multiple links) like

<a class="coupon_link" href="#?stockAlert=45">Click here to get coupon</a>
<a class="coupon_link" href="#?stockAlert=46">Click here to get coupon</a>
<a class="coupon_link" href="#?stockAlert=47">Click here to get coupon</a>

[code]....

View 4 Replies View Related

Pre Populate Text Field Based On Another Text Field

Jan 23, 2010

I'm developing a web page. It includes 2 text boxes. One text box for city and another text box for std code. I wrote the code for auto suggestion to city. Now i want to pre populate the STD code when ever a known city is selected (when city is selected from the recommendations displayed for city field).

View 8 Replies View Related

JQuery :: Use Tagify Plug-in To Populate Text Field With Dynamic Labels?

Sep 7, 2011

Have the following code which (resides in a dialog box) and serves as an event listener for check boxes. Am able to populate / de-populate text field with values from check boxby checking or unchecking the individual check boxes:

// Event listener which picks individual contacts// and populates input field.
$('#emailCheckListId_ul input:checkbox').change(function() {
// Declare array
var emails = [];

[Code].....

However, when I use try to use theJQuery Tagifyplug-in it only creates one "tagified dynamic label" inside the text field but doesn't create another label when I click on an additional check box. Also, when I uncheck the original checkbox, itdoesn't remove the original label.

Here's my code using the JQuery tagify plug-in (all I did was keep everything the same as above but called the tagify functionon the text field):

// Add / Remove array from text fieldtextField.value = emails;
// Decorate with dynamic label
$(textField).tagify(emails);

I get this JavaScript error in the browser:

jquery.tagify.js: 'options' is undefined, line 71

In the source code this line reads:

_setOption: function( key, value ) { options.key = value;
},

Its stating that options.key is undefined...

To view the jquery.tagify.js complete source, clickhere.

Is there a way I can create an "else" for example:

// Iterate through each array and put email addresses into array$('#emailCheckListId_ul input:checkbox:checked').each(function(){
// do something
});

[Code]....

View 1 Replies View Related

Pre-populate A Form Field?

Aug 24, 2006

I know not one word of Javascript and wondered if there was
an easy way to pre-populate a form field in a similar manner to
populating an eMail 'subject' field? -

The following populates the subject field in an eMail:
a href="mailto:me@anwhere.com?subject=USER ID 12345

How can I populate the first field of a form (or can I?) with the
same information - i.e. the USER ID located on the HTML page
calling the form?

View 5 Replies View Related

Input Field To Populate A Div?

Apr 15, 2011

I am in the process of making a single page website for a local radio group of roughly 20-30 members which may increase over time. They want to be able to show when they are online. The idea I had was basically to put a login field near the top of the website where they would input a "call name" and their real name, so 2 different fields. After clicking the submit button I want to populate a listable(doesn't really matter which) to show that they are "online", and once the session has ended(closed the webpage) have it remove them from the list.There doesn't need to be any security, no cached information, no cookies, and as simple as possible. How might I go about doing this?

View 1 Replies View Related

Populate Div From Textarea Field?

Jan 21, 2011

I want to create a div above every textarea field with its content so it will be printable. However for the first 2 fields the content is the same in the both divs

// JavaScript Document
$(document).ready(function(){
$('textarea').each(function(index) {

[code]....

View 3 Replies View Related

JQuery :: Auto-focus On Next Input Field?

May 11, 2010

I'm trying to make a form with a postal code input. But there are 6 input fields within a div container. When some one types just one letter they automatically go to the next input field this continuing until they reach the last input area.

View 2 Replies View Related

OnClick Event To Populate A Different Field?

Oct 6, 2011

I'm creating a ticketing web page where the start time of the ticket would need to be generated whenever the user clicked on the ticket number field.So, what I'm trying to figure out is how I can create an OnClick event for the TicketNumber textbox so that it will save the time it was clicked to a StartTime textbox.I've done a bit of searching and have only found code that would populate data to the same text box onclick.

View 1 Replies View Related

Populate An Acrobat Field With A Date Only Once?

Jan 23, 2009

I have a small script which runs when the acrobat document opens and populates a field with the date, but I would like the date to be filled when the document is first opened, then saved with that date.

code:
// get new Date object
var d = new Date();

[code]....

View 1 Replies View Related

Split Name And Populate Email Field?

Oct 15, 2009

I have a web form that requests a user full name and email address. What I would like to do is when the user fills in the full name in one input box, I would like to take the full name and populate the email address field as such. "first.last@allstate.com". So pretty much split the full name and popluate email address field "first.last@allstate.com".

View 1 Replies View Related

Populate Text Field Using Onmouseover

Jun 18, 2010

I have a table where when the cursor passes/hovers over a cell, the current cell, as well as the top cell in its column and the first cell in its row change backgroundColor. I have text fields outside the table which I want to populate with the contents of the cells affected by the mouseover event. So as the mouse moves over different cells, the contents of the text fields changes accordingly. I've got the backgroundColor to change, but when I try to assign the contents of the cells to the text fields, nothing happens. The change of backgroundColor even stops working. This is the code I'm usign to populate the fields.

document.getElementById("tableID").textfieldID.value = Col1Cell[0].innerHTML;
document.getElementById("tableID").textfieldID.value = HeaderCell[n].innerHTML;
document.getElementById("tableID").textfieldID.value = this.innerHTML;

I'm traversing through the <th> and <td> tags to find the header cell HeaderCell[n] and first column cell Col1Cell[0] associated with the current cell. If I leave out these lines the backgroundColor changes, if I use them, nothing happens at all.

View 2 Replies View Related

Populate Hidden Field With Cookie?

Mar 19, 2009

Im trying to populate 2 textboxes with 2 cookies using the code below

<html>
<head>
<script src="cookies.js" language="javascript"></script>

[code]....

View 2 Replies View Related

How To Populate A Hidden Input Field

Dec 14, 2009

here's the code that I've written that doesn't work,what I want to do..

HTML Code:
<script language="JavaScript" type="text/javascript">
//function that should populate the hidden field

[code]....

View 3 Replies View Related

JQuery :: Auto-tabbing From A Text Field To Checkbox?

Apr 28, 2009

I'm trying to do autotab from a textfield to a checkbox . but it is not working . Here is my code

<html>
<head>
<title>Check Box</title>

[code]....

View 2 Replies View Related

Jquery :: Radio Button Auto-Fill Another Field

Jul 27, 2011

I'm pretty new to coding. I have a form with two radio buttons to choose from. I would like a custom javascript function (fillShowTypeCost) to automatically update a text field with the correct amount of money, based on which radio button is selected. I originally had this form done with checkboxes and it worked just fine. Since I switched to radios, I am completely lost. I have tried using an array search to determine which value is selected, but I must be doing something wrong, because it isn't working. My codes are below. (The PHP end of things are working great.)

My PHP/HTML Code:
//Radio Button 1:
<input name="showtype" type="radio" id="showtype" value="basic" <?PHP print $basic_status; ?> onclick="fillShowTypeCost(this.form)"> Basic Slideshow

//Radio Button 2:
<input name="showtype" type="radio" id="showtype" value="lovestory" <?PHP print $lovestory_status; ?> onclick="fillShowTypeCost(this.form)"> Love Story

//Text field to be auto-updated
<input name="showtype_cost" type="text" id="showtype_cost" value="<? echo $row_settings['showtype_cost']; ?>">

View 5 Replies View Related

Populate Text Field From Drop Down List

May 1, 2009

how to create a somewhat simple form. The form will have text fields for 'Name', 'Phone', etc. What I want is to have a drop down list, which has different insurances to choose from (i.e. Medical Insurance, Dental Insurance, Senior products), and say when I choose 'Senior Products', new text fields pop up within the form to add their 'Address' and click a checkbox that states they authorize to be contacted. These new fields aren't visible unless they choose 'Senior Products' from the drop down list.

View 6 Replies View Related







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