Form With DropDown And Input Field - Function Error

Oct 31, 2011

New to working with javascript and I've come up with a function. I have a form with a dropdown and input field:
<form>
<select name="warranty" id="warranty" onChange="doadate()">
<option value="Select">Select</option>
<option value="In Warranty">In Warranty</option>
<option value="Out of Warranty">Out of Warranty</option>
<option value="DOA" selected>DOA</option>
</select>
<input name="doadate" type="text" id="doadate" value="<? echo $doadate; ?>"
size="20" readonly>
</form>

I need the input field to be disabled unless DOA is selected in the select form element. I've started on page load with document.form1.doadate.disabled=true. Then I've put an onChange handler in the select to call the function below:
<script type="text/javascript">
function doadate(){
val = document.form1.warranty.value;
if(val=='DOA'){
document.form1.doadate.disabled=false;
} else{
document.form1.doadate.disabled=true;
}}
</script>
But it's not working, it stays disabled after load even when the DOA is selected in the drop down form field.

View 4 Replies


ADVERTISEMENT

JS: Populate Input Form Field With Function Variable?

Jul 29, 2010

Tried searching but didn't seem to find a solid solution to my problem I'm trying to pass a value to an input form field, from a function. Here is my code

PHP Code:
<script>
function createDiv(sceneNum, startTime, endTime, dialog, notes)

[code]....

View 3 Replies View Related

Invoice Form - User Can Add - Input Field - After Adding A New Input Field - The Content In The Other Fields Is Deleted

Sep 1, 2011

I'm now working on kind of invoice form which in it the user can add as much input field as he wants.

The problem is that after adding a new input field - the content in the other fields is deleted.

Code:

View 8 Replies View Related

Phone Number Form - Error-check It So That Only Numbers Can Be Entered Into The Phone Number Input Field?

Sep 26, 2011

I am working on a Phone Number Form. The link of script: [url]

Questions:

(1)I wanted to know if code this script so that instead of the phone number appearing as: (123)456-7890

So that it appears as: (123) 456-7890 with a blank space after the ")"

(2)If that's simple, is there a way to error-check it so that only numbers can be entered into the phone number input field?

View 1 Replies View Related

Jquery :: Hide Input Field If Dropdown Item Selected

May 24, 2010

I have a page as below, I hope the form only show Select option when loading, then the input date fields will be displayed if select event category, where are the errors?

Code:
<script src="/misc/jquery/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$.viewInput = { '0' : $([]),
//THIS IS THE NAME OF THE DIV WRAPPING THE HIDDEN FIELD
'1' : $('#1'),
};
$('#category_class').change(function() {
// HIDES THE INPUT FIELD IF ANOTHER DROPDOWN ITEM IS SELECTED ONCE THE HIDDEN FIELD IS LOADED
$.each($.viewInput, function() { this.hide(); });
// SHOWS THE INPUT FIELD ITEM IF SELECTED
//$.viewInput[$(this).val()].show();
}); });
</script>

<table cellpadding=4 cellspacing=1 width="650" border=0 class='list'>
<tr> <td class='caption'>
<form action="save.asp" name="pvt_spec" method="post">
<table border=0 cellpadding=4 cellspacing=0>
<div id="1"> <tr>
<td nowrap><font size=2 color="#ff0000"></font>Start Date</td> <td class='data'>
<input onClick="this.select()" tabindex="1" type="text" name="s_dt" value="2000/01/01" size="13" maxlength="13" STYLE='text-align=center;'>
</td> </tr> <tr>
<td nowrap><font size=2 color="#ff0000"></font>End Date</td> <td class='data'>
<input onClick="this.select()" tabindex="1" type="text" name="f_dt" value="2078/12/31" size="13" maxlength="13" STYLE='text-align=center;'>
</td> </tr> </div> <tr> <td>category</td> <td class='data'>
<select name="category_class" id="category_class" tabindex=1><option value="1">Base category</option><option value="2">Parent Event Category</option><option value="3">Son Event Category</option></select>
</td> </tr> </td> </tr> </table>

View 9 Replies View Related

JQuery :: Undefined Error While Accessing Input Field

May 12, 2011

I am new to Jquery. I have a simple form with input field.when I do an alert in document.ready it gives me undefined error.[code]

View 4 Replies View Related

Highlight The Row Color When The Input Field Is Changed But Get An Error?

Jan 1, 2011

I'm trying to highlight the row color when the input field is changed but get an error

Code:
<script type="text/javascript">
function toggle(trid){

[code]....

View 1 Replies View Related

Simple Form Dropdown That Opens A Text Input?

Dec 23, 2010

Been racking my brain all day trying to figure out how to duplicate this code with the limited javascript knowledge I have been trying to learn.This code is a Dropdown menu of Yes or No, than a Select button that Opens up a Text Input directly below the dropdown. So far, It works great. My problem is I need at least two of these on the same page and I do not know how to go about it. I have tried changing values to accommodate adding another on the same form, but than both stop working.

<html>
<head>
<SCRIPT language="javascript">

[code]...

View 5 Replies View Related

JQuery :: Add Fixed Value To Form Input And Send To Separate Form Field

Jun 3, 2011

I've have a function to take the value entered in a form text box, add 50 to it and put the result in another text box.

When I enter 650.5 I get 700.5 exactly how I'd expect. But when I enter -650.5 instead of getting -600.5 I get -650.050 as though it is failing to parse the float due to it being negative. My understanding of parseFloat was that it recognises negative numbers. Is there a nice simple way to get this to work?

View 1 Replies View Related

Pass User Input From A Form To One Database Field Using Several Form Elements

May 4, 2009

I need to pass user input from a form to one database field. I'm relatively new to JS but the idea I had was to have several form elements and use JS to collect the users input and send all the values through a hidden element. What's happening is the variable names are being sent rather than the values. The code below is only passing to the next page. Limitations: I am editing an intranet site built by a 3rd party so a lot of the files we've been given are encrypted. I cannot change the method to post.

[Code]....

View 3 Replies View Related

Universal Form Validation - Focus On 1st Error Field

Aug 3, 2006

I have managed to create a very basic form validation script that I can retrospectively add into current forms with the least effort.

As far as the validation goes I am sure that the script is not pretty, but it does work. However, I have failed to manage to get it to return the focus to the first field that errors.

My abortive attempts are not included in the attached script because I have tried and failed with many different attempts that I have confused myself. I would appreciate any advice that could point me in the right direction to place the focus in the first error field found. Code:

View 3 Replies View Related

Input Field Being Affected By A Function?

Jul 7, 2010

Below is my previous code I had working in the manner it would change the price, sub_total, tax, sh, total, and total_paid input fields to 0. There are two problems with this.... When it outputs to the input fields, the value displays as 0 instead of 0.00.2. I need to have it only react when the value typed into the input field "trees_sold" is "0". If any higher, I would like it to ignore the statement.

Code:
<!-- Comp all prices to zero value -->
<SCRIPT LANGUAGE="JavaScript">

[code]...

View 1 Replies View Related

Input Field Being Affected By A Function

Jul 7, 2010

Below is my previous code I had working in the manner it would change the price, sub_total, tax, sh, total, and total_paid input fields to 0. There are two problems with this...

1. When it outputs to the input fields, the value displays as 0 instead of 0.00.
2. I need to have it only react when the value typed into the input field "trees_sold" is "0". If any higher, I would like it to ignore the statement.

<!-- Comp all prices to zero value -->
<SCRIPT LANGUAGE="JavaScript">
var trees_sold = 0.00;
function InitSaveVariables(form) {

[Code]....

View 14 Replies View Related

JQuery :: Two Input Fields / Give Second Input Field Always Same Value As Input Field One

Jun 7, 2010

I am having a form with two input fields. I want to enter some text in the first input field and then the second field should get the same text. Is there a simple way (maybe a plugin) to do this with jQuery? It would be perfect if I even could output all these input fields values as normal text in <p> or <li> tags.

View 2 Replies View Related

Run A Function When Text Is Typed In An Input Field?

Jul 15, 2011

I want to run a function when text is typed into an input field. So every time 1 character is put in it will process a function. However I do not know how to accomplish this. I tried the onchange attributed but that seems to only work when you unselect the input field.

how this might be accomplished? I'm also comfortable with jQuery if you think that's a better option.

View 2 Replies View Related

JQuery :: Add A Value To An Form Input Field?

Nov 19, 2010

I have this script where i call a jquery ajax to calclate something and then put it back in the form input so then i post everything to a php script where it insert it in mysql database. Here is the script :

<!--Date/Time Picker -->
$(document).ready(function(){
$("input#dep_d").AnyTime_picker(

[code]....

View 2 Replies View Related

Reference A Form's Input Field That Has A Dot In Its Name?

Mar 23, 2006

How can I reference a form's input field that has a dot in its name e.g object.name ?

View 3 Replies View Related

Clear Input Field - "Uncaught ReferenceError: ClearInputField Is Not Defined" Error

Jun 27, 2011

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="javascript/text">
<!--
function clearInputField( input, def )
input = document.getElementById( input );
[Code]...

This gives me a "Uncaught ReferenceError: clearInputField is not defined" error and I'm not sure why...?

View 4 Replies View Related

JQuery :: Track Input Field Text And Run Function On The Fly?

Sep 2, 2010

How can I track what is written to an input field on the fly(event that is not "click" "hover" etc but something like "track" or "observe")?Lets say I have a js object like this:

var array1 = {id1: 'keyword', id2: 'execute', id3: 'go'};

And 3 input fields like this:

<input id"id1" name="id1"></input>
<input id"id2" name="id2"></input>
<input id"id3" name="id3"></input>

I want to track the input fields so that

if(
the string "keyword" is written to the id1 field
the string "execute" is written to the id2 field

[code]....

View 1 Replies View Related

JQuery :: Form.submit Not Function Error Form Plugin?

Jan 8, 2010

I'm trying to get an upload popup working with the jQuery form plugin[URL].. When I click a link I load a form html from the server and add it to a container div by setting the div's html attribute. I then attach a submit handler to the form so I can call the ajaxSubmit function of the form plugin.

[Code]...

View 1 Replies View Related

Control Charcters In Form Input Field

Jul 20, 2005

In a form I have an input field. It's supposed to get input form a
scanning device. Thus, the input might contain special characters (like
the Group Separator in a EAN barcode). Now, I want to manipulate a
little with the input in a javascript, but I'm not able to find the
Group Separator:

input = document.main.input.value;
var a = input.split("");
var i;
for(i=0;i<a.length;i++) {
if(/x1D/.test(a[i])) {
alert("GS");
}
}

This is a snip that parses the input, character by character, and gives
me an alert if the Group Separator (Hex: 1D) is found. But it never
matches, even if I know that the input string contains in. I have a
similar script written in Perl, an that script finds the Group Separtor.

What can I do to find the %"#¤ Group Separator??

View 4 Replies View Related

Form Field (Input Or Textarea) Focus

Mar 4, 2010

Is there a way to give an input or textarea field the focus and set the focus to begin right at the end of the current text in the field?

View 3 Replies View Related

Set A Custom Attribute On Form Input Field?

Aug 19, 2010

I am trying to use SetAttribute to append a custom attribute to a form input. The code is below.

Code JavaScript:
function getpostdata(){
// Append the values[code].....

View 4 Replies View Related

Passing Reference To Form From Non-input Field

May 27, 2004

I have a bunch of forms in my page, and want to pass a reference to the current form to a javascript function - when, say, a user clicks on a particular element. Normally, within any type of input field, I'd just add something like this:

onclick="my_function(this.form)"

Then, in my_function( form ) I could refer to form. No worries.

But here's the interesting bit. I also want to run the same function when the user clicks on any <a> tag within a form, like:

<a href="javascript: my_function(this.form)"> ... </a>

Problem is, with this code, the form reference isn't passed to the javascript function. the "this.form" bit doesn't work...

I find this rather curious. So the question is, how do I pass a reference to the current form from within a non input field?

View 5 Replies View Related

Form Validation Error - Input Data In Proper Format

Nov 25, 2008

What is happening is when I try to submit the form, I receive an error that says I need to input all data in the proper format.
<html><head>
<title>Conference Registration Form</title>
<link href="conf.css" rel="stylesheet" type="text/css" />
<script type = "text/javascript">

Calculate total registration fee
Retrieve the value of the selected index property from guests selection lists
Multiply the selected index by 30 and add this to the cost variable
If the first member radio button is checked subtract 25 from the value of the cost variable
Set the value of the total field equal to the value of the cost variable

function calcCost() {
cost = 145 + (guests_quantity * 30);
guests = document.reg.guests;
gindex = guests.selectedIndex;
guests_quantity = guests.options[gindex].value;
if (document.reg.member[0].checked == true) {
cost = cost - 25;
} document.reg.total.value = cost; .....

View 1 Replies View Related

Pull A Value From Inside A Div Then Populate A Form Input Field With That Value?

Sep 13, 2011

Basically I need to:

1. Pull a value from inside a div

<div id="number">(invoice #1017)</span>

2. Populate a form input field with that value.

View 4 Replies View Related







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