I am constructing an HTML questionnaire and one of the questions
requires people to rate some choices from 1 to 5, where 1 is their
favourite and 5 is their least favourite:
Car
Bus
Taxi cab
Train
Airplane
Each choice has an INPUT TYPE=TEXT tag to contain the response. I
also have a function that is called ONCHANGE in order to check that a
number is entered between 1 and 5:
function CheckNos(obj) {
if(obj.value.match(/[^d]/) || obj.value<1 || obj.value>5)
{alert("Please enter a number between 1 and 5");obj.value="";return
false}
}
This works fine, but ideally I would like a function that could check
ONCHANGE that someone has not filled in the same number twice, for
example answered "1" for all of them. They are only allowed to use
each rating number once, so rating their choice 1 to 5.
Can anyone suggest a short function that could accomplish this easily?
Could I use some kind of array with 5 elements and allocate a flag
value once that number had been chosen, then check that the value had
been set?
I am using this code to validate a form to check that only numbers have been entered but when I enter alphabets the javascript raises an error but still submits the form.
I'm trying to make sure that when a user enters information into my textbox, that when the textbox loses focus then it checks to make sure that they entered numbers and not text or other characters. Numbers only....Any suggestions?
I have the following code that I wrote myself (except for the function isNumberKey). However, I don't know how to actually add the numbers together. My plan is to store the value entered in the forms as a variable, then manipulate the variables to get my final number. The final number would be stored in variable named Total and would be displayed after Total: at the bottom of my page.
function check_email(mailstring) { valid = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM"; for(i=0; i < mailstring.length ;i++)
[Code]....
at the moment its checks that someting has been enetered in all these fields,
what would be the best way to check that the email or phone nummber had been entered?? will not send if nothing enetered, but will send if one or both have been enetered?
The following Javascript will return an error message if the user did not enter any value into the zip code field. The form will submit even if user entered only 1 character. Does anyone know how to change this to at least minimum 5 characters must be entered into the field?
...} var fname = "CustomFields_17_2"; var fld = document.getElementById(fname);
I would like to add a plausability check for numbers with JS, but regex is not really a strong knowledge of mine. Can anybody give me a hint, or lead me to the right script for doing this?
Inside the form a user can place a price which I would like to be only a number, smaller than 100000 and there should no , or . be inside the value. otherwise they should see an alert message. Code:
I have a form with a text box where users can enter a 10 digit code. The 10 digit code can be just numbers/letters (eg. 0123456789 or abcdefghij) or it can be a mixture (eg. 0a1b2c3d4e). What I would like is if the user enters a code which is a mixture of numbers and letters then the submit url goes to mixed.php If the user enters a code which just has letters or numbers then the submit url goes to sole.php change the url from selecting radio buttons.
I've got a url field on a form that is not required but if it's entered I want it to be correctly entered to keep errors down. This is for an admin screen so I'm not concerned about cross site scripting attacks or anything, I just want to make sure that the URL is properly formed.
So far I've come up with the following code snip but I wonder if anyone can comment on it or perhaps come up with some improvements. Code:
my assignment is to create a script that will prompt users to enter a series of integers and display only the largest one. I'm having troubles figuring out how to set a var to the first item entered. I have set an array to load the #'s, and will use a for loop - does this sound right?
this is what i have so far:
Code:
var list = new Array [10]; var largest ; function displayLargest() { for (var i = 0; i < 10; i++);
I am making a form validator which has some field like "credit card number" and "credit card security code". I need to make sure that those fields only contain digit, no alphabet and any others characters like "." , "," , etc.
Here is my code: <html> <head> <title>JQuery FOrm Test</title> <style type="text/css"> body { font: 11px/15px verdana, arial, helvetica, sans-serif; }
This involves the use of an order form used to process a purchase via Paypal. The items are small rhinestone letters for names and such.
The form is very simple in that the purchaser enters into form field one: the letters they wish to purchase. Form field two (this is where I rely on common sense by the purchaser): enter the number of letters entered in form field one.
Based on the number of letters entered in form field two, my form processes the correct cost for the purchase.
As you have already figured out, I am beginning to see people enter their letter orders w/out entering the number of letters ordered.
All that said: a way to count the letters entered in form field one and auto-populate form field two with that number. Code:
I have a html form and I have three text boxes named Max Accessories: Accessory SKU: Accessory CPC ID:
And I want a javascript functionality like, if the user enters in the max accessories text box value as 1, then the below two text boxes should update like automatically like below: Accessory 1 SKU ACCESSORY 1 CPC ID
Similarly if user enters Max accessories value as 2 in the text box, then the below two text boxes should update like automatically like below: AcceSsory 1 SKU ACCESSORY 1 CPC ID AcceSsory 2 SKU ACCESSORY 2 CPC ID OnChange of the key, for accessory it should call some function in the same page and dynamically update.
I use a ticketing website at a call center. I have javascript injection bookmarks with some of the more common issues, but my issue is even after I populate everything when I try to submit the ticket, it won't recognize that somethign is there unless i go through and hit enter in each form i autopopulated.Most are drop down lists. Is there any way to submit each form(when i hit enter) after the text gets entered in there?
I am inexperienced in JavaScript. I have an html page with several numeric input fields which are an array. At the bottom of the screen is a running total of the numbers entered.
The html is like: <INPUT TYPE=TEXT NAME='array[0]' onchange='addup()'> <INPUT TYPE=TEXT NAME='array[1]' onchange='addup()'>