Check If Textfield Has Numbers Then Submit Form?
Jun 1, 2011
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.
View 2 Replies
ADVERTISEMENT
Mar 19, 2010
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.
<script type='text/javascript'>
function isNumeric(elem, helperMsg){
var numericExpression = /^[0-9]+$/;
if(elem.value.match(numericExpression)){
return true;
}else{
alert(helperMsg);
elem.focus();
return false;
}}
</script>
<form>
Numbers Only: <input type='text' id='numbers' action= "desktop.html"/>
<input type='button'
onclick="isNumeric(document.getElementById('numbers'), 'Numbers Only Please')"
value='Check Field' />
</form>
View 4 Replies
View Related
Sep 25, 2009
I have a php form and it has 3 submit buttons namely "delete" , "update_quantity" and "place_order".They all work fine but I want to build in a check for each one just in case the user click one of the buttons by mistake.So Each one must have a different message like for delete it must be, "Are you sure you want to delete Record nr ......" OK or Cancle.
And for update " Are you sure you want to update Quantity to....." OK or Cancle.
View 2 Replies
View Related
May 19, 2010
I'm using the submit and ajax functions to check a form. When the form is submitted the submit event executes and within that event the data (a code the user has to fill in) is sent to the server to check if it's correct. If it is correct, the submit event supposes to return true (so the form submits), if it's incorrect the submit event supposes to return false (so submitting the form cancels).
Here's my code that should do this:
$(function(){
var submit = false;
$('#login').submit(function(){
$('span.error').fadeOut('slow');
$.ajax({
url: '/ajax/login',
type: 'POST',
data: 'code=' + $('#code').val(),
success: function(response){
if (response != ''){
$('span.error').fadeIn('slow').text(response);
submit = false;
}else{
submit = true;
}}})
return submit;
})});
But here's the problem: While jQuery does the ajax request, the script continues. So it will return false - even if the code is validated - because the var submit has been set to false at line 4. When I submit the form again, the form is validated because 'submit' is true (but that's set to true the first time). How can I ensure the submit function waits for the ajax request to finish?
View 3 Replies
View Related
May 25, 2010
I have a form with a text field and a submit button. I don't want the form to submit if the text field is filled in correctly. for example a email address typed in the text field area. I'm working with spry validation but i guess i need to add some kind of onSubmit event, with javascript. I have some idea but not sure what to fill in by the "if statements" in the script.
View 3 Replies
View Related
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
Jul 23, 2005
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?
View 5 Replies
View Related
Jul 26, 2005
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:
View 8 Replies
View Related
Jan 7, 2006
i need a check that can go through a string to see if it contains any numbers.
View 12 Replies
View Related
Apr 8, 2009
I have a piece of javascript code.
1. It retrieves a value of a cookie (this works)
2. A function is called to check that only whole numbers were entered into an inputbox.
Code JavaScript:
When I load the page, the page gives a "The page loaded but with erros" warning, and the code doesn't work.
I call it using:
HTML Code:
View 3 Replies
View Related
Nov 24, 2009
I was wondering if it is possible to validate tex boxes and check for numbers etc..
Take a look at this page:-[URL]... I want to validate the "Average annual income" and "Holiday entitlement" fields.
The salary field should be no bigger than 1000000 and should display to two deciaml places, and the holiday field should be no bigger than 99.9..
View 1 Replies
View Related
Apr 2, 2011
This is the function CheckmyForm.I need check that you enter only letters, numbers and special characters ",", "." and ";" in the TextareaS1 field.
View 24 Replies
View Related
Jul 29, 2009
How do I get the value of a form textfield ?
View 2 Replies
View Related
Sep 14, 2011
i am trying to pass a javascript variable into URL ..but not getting the value..var newID = 2;row.insertCell(6).innerHTML = "<a href=Update_Gate.cfm?GateIdVar=newID>Edit Gate</a>";i am getting"newID" in Update_Gate.cfm page ...i want to pass this javascript variable in url and read it on the other page as form field value
View 2 Replies
View Related
Sep 15, 2011
i am trying to pass a javascript variable into URL ..but not getting the value..var newID = 2;row.insertCell(6).innerHTML = "<a href=Update_Gate.cfm?GateIdVar=newID>Edit Gate</a>";i am getting "newID" in Update_Gate.cfm page ...i want to pass this javascript variable in url and read it on the other page as form field value
View 2 Replies
View Related
Nov 10, 2009
Say I have a textbox in a form that I do not want the user to have the ability to put any spaces. This example is for someone's name converting to a short url so no matter what, their name is like JohnDoe and during the typing of it, the user cannot put a space between their name. Is this an HTML or Javascript thing to pretty much disable spacebar just for that field?
View 9 Replies
View Related
May 4, 2001
Is it necessary to use cookies when you want to save information in a form textfield and be able to click back to that page and the information is still there before submitting it. Sometimes it seems to stay sometimes not?
View 1 Replies
View Related
Jul 18, 2009
I have an .asp page for my customers which does just accepts e-mail information and passes this information to another .asp page. But before passing the info, a javascript checks whether the entered e-mail does match some certain rules. Rule1: If any input has been made at all, Rule2: If an "@" sign is there, if the"." is there and so on. upon pressing the submit button, the first rule works but the second rule does not. Could not figure it out why.
[Code]...
It is the function control() which validates the e-mail field. But it just validates whether the e-mail has been entered or not. The second check (with the @ sign) is not being made.
View 1 Replies
View Related
Nov 15, 2011
Here is the code I have written but it is only taking one value out of the several checkbox checked
View 3 Replies
View Related
Apr 23, 2010
Adding this counts twice which proves that the page redirects twice.
For some reason this form redirects twice to the same page
Adding the form action to users.php doesn't help 'cause the checkboxes don't retrieve the updated data.
Is there a better way to update MySQL via checkboxes?
View 15 Replies
View Related
Apr 23, 2009
On my form I have 3 submit buttons which handle different things.I am looking for a way to stop or continue form execution with a confirm box on the third submit button and the third only.I can't use onsubmit because that will trigger on all three buttons.
View 2 Replies
View Related
Jul 13, 2011
In the following .submit function, I am attempting to grab the value of the selected option in the facilityCodes dropdown list when I click the submit button and then during the submit function,select the facilityCode again in the dropdown list when the page reloads and then disable the list so that the user cannot change it.However,the situation is when I reload the page after the submit button is clicked the dropdown defaults to the first option and the list is enabled.I apparently am not understanding how.submit works so that I'm selecting the option I'm defining in my code below and then disabling the list AFTER the page reloads due to an error on the page. My question is how can I accomplish this?Here is my code:
$(function() {
$("#ARTransferForm").submit(function() {
var msgsCount = 0;[code]....
View 1 Replies
View Related
Jul 23, 2005
The following will submit the form data to popup by clicking the submit button. I want it will submit the form automatically to the popup, there is no submit button in this page. Basically this page should not show up.
<script type="text/javascript">
function submitmyform(f) {
f.target = 'foo'
window.open('',f.target,'menubar=no,scrollbars=no, width=800,height=800');
f.submit();
return false;
}
</script>
<form name="myform" action="popup.asp" target="_blank" method="post"
onsubmit="return submitmyform(this);">
<input type="hidden" name="item" value="item"/>
<input type="submit" value="submit to popup"/>
</form>
View 2 Replies
View Related
Sep 28, 2010
I'm using mailchimps signup box (they don't have a decent forum to ask on) on my website and want to adjust the submit button and change it to a normal link. Here's the button that submit's the form:
[Code]...
View 14 Replies
View Related
Aug 31, 2003
Another quick question. I have the script to add each field up I need, but if the ending 0 after a decimal is present it doesnt show. How do I keep the leading zero and how do I keep just 2 digits after the decimal?
For example:
1 + 1.50 = 2.50
But javascript displays it as 2.5
Now sometimes when I do math I get:
2.3454545
In this case I just want 2.34. So if there is a ending zero I want to keep it, and if there is more than 2 numbers after the decimal I want to cut the rest off and leave the 2 there.
View 8 Replies
View Related
Jan 31, 2008
I have a page with many forms that I need to change from a post to an ajax call. That part is working, no problem, but now I want to disable the submit button while it's waiting on the server response and then re-enable it when the response comes back.
Here's what I have:
$(function() {
$('form').each(function() {
$(this).submit(function(){
[code]...
I can't figure out what my selector should be to get the submit button of the form that's being submitted. What should I be using instead? Also, if the call errors out, I'd like to just post the form as usual.
View 12 Replies
View Related