JQuery :: Validating Zip Code - Match / Mismatch User Entry
Jan 28, 2011
I need to make sure the zip code the user enters matches up with 1 of 50 acceptable zip codes - so if they enter nothing at all or enter a zip code that does not match up with one of the 50 acceptable zip codes they get an error. I know I need some kind of conditional statement like:
if (#zipcode != "12345 || 23456 || 45678 || 12365") .. do something...
View 9 Replies
ADVERTISEMENT
Oct 11, 2009
This code will not work no matter what I do.
function comparePassword(){
pass1 = document.getElementByName('password');
pass2 = document.getElementByName('cpassword');
if(pass1.value != pass2.value){
document.getElementById('matchpass').innerHTML = "Passwords do not match!";
}}
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "[URL]">
<html><head>
<title>Game Makers United - Uniting game makers with the help they need</title>
<script language="Javascript" src="javascript.js" type="text/javascript"></script>
</head><body>
<form method="post" onsubmit="comparePassword();" >
<table width="100%">
<tbody><tr>
<td width="150px">Username: </td>
<td><input type="text" name="username" maxlength="32" /></td>
</tr><tr>
<td width="150px">Password: </td>
<td><input type="password" name="password" maxlength="32" /></td>
</tr><tr>
<td width="150px">Confirm Password: </td>
<td><input type="password" name="cpassword" maxlength="32" />
<span id="matchpass"></span></td>
</tr><tr>
<td><input type="submit" name="register" value="Register" /></td>
</tr></tbody></table>
</form></body></html>
All it's supposed to do is check whether or not "password" and "cpassword" match, if they don't it's supposed to put "Passwords do not match!" in the span "matchpass". I can't see anything wrong with the code and javascript is enabled in my brower. GetElementByName does not exist, so I switched it to getElementById and it works perfectly.
View 2 Replies
View Related
Oct 21, 2010
In a registration form middleName field is optional. When the users enters his/her middleName, then it should validate that field. I have used the following code to achieve the above scenario, but it is not working.
$("#middleName").rules("add", {checkName: true, required: false, messages: {checkName: "Please enter a valid middle name"} });
jQuery.validator.addMethod("checkName",
function(value, element) {
var regExp = new RegExp(/^[a-zA-Z0-9s|,|.|-|']+$/);
return regExp.test(value);
},
"Please enter a valid name."
);
How to achieve the above scenario.
View 1 Replies
View Related
Aug 18, 2010
Want to add numbers using JS. Have 4 text boxes for user entry.
Want either a label (preferred) or fifth text box to automatically sum those entries.
Did following but not working.
Input as follows:
View 4 Replies
View Related
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
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
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
Mar 23, 2011
I am trying to make a gui for clients to edit a php page that displays html and javascript.
I want the user to be able to move html elements around and even edit it like add effects like fade in and out etc.
Then after all the changes I want to overwrite the existing php file that does this for that user. how can you make such changes and then save it to a file?
It's an html / javascript editor but using a gui instead of allowing them to directly touch the code. It would be a security risk if I allow such a thing. So I need to program a interface that would make such changes and save them to file.
Like how can you delete and add new javascript code to the file?
View 3 Replies
View Related
Oct 5, 2010
I am trying to validate a ZIP code form entry to allow only numbers and exactly 5 digits. The following code validates for numbers only, but I can't get the 5-digit minimum integrated. correctly.
onchange="if (/^.?$/.test(this.value) || !/^-?d*.?d*$/.test(this.value)) {alert('Numbers only please.'); this.value=''; this.focus()}
View 2 Replies
View Related
Aug 20, 2011
I'm trying to tweak a small script to pull some data from an iTunes podcast formatted XML feed. Currently, it outputs a link to the most recent actual mp3 file with the episode title as the name (which is great), but I'd also like it to show a description of the episode under the link.Here's the code I have so far:
Code:
jQuery(
function($)
{[code].....
How can I tweak my existing code to output the content of the first <itunes:subtitle> entry under the link it generates?
View 3 Replies
View Related
Apr 29, 2011
I am trying to setup a donation form for a friend, where someone can click radio buttons for set donation amounts, or click the "other" radio buttons and enter a different amount. The donation amount is then passed over to a secure credit card entry page, hosted by a 3rd party merchant.I can set up all the pre-defined radio buttons to correctly pass on the donation amount to the credit card page, but I cannot figure out how to work the "other" radio button amount.
View 6 Replies
View Related
Apr 29, 2011
I am trying to setup a donation form for a friend, where someone can click radio buttons for set donation amounts, or click the "other" radio buttons and enter a different amount. The donation amount is then passed over to a secure credit card entry page, hosted by a 3rd party merchant.
I can set up all the pre-defined radio buttons to correctly pass on the donation amount to the credit card page, but I cannot figure out how to work the "other" radio button amount.
View 2 Replies
View Related
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
View Related
Jul 23, 2005
I am looking for a general purpose javascript snippet that enables me to
<div> or <span> HTML to make portions of the form be hidden and then appear.
The form contains about 12 sections and some sections can contain
subsections. When the user clicks on a checkbox, I want previously hidden
text boxes, radio buttons, text, drop down menus, and additional checkboxes
to appear. In some cases, clicking on a checkbox in a section can cause
additional previously hidden text boxes, radio buttons, text, drop down
menus, and additional checkboxes to appear.
Within each section, a list of individual names is displayed with an initial
checkbox beside each name being displayed. Clicking the checkbox beside a
name is what triggers the hidden info to be displayed. The server side
application is written in php and the field names are assigned using
brackets as the array is created. As an example the HTML checkbox beside
the first name <input type='checkbox' name='sect1custname[1]' value'First
Name'> The HTML for the next name woud be exactly the same except the name
field would be defined as name='sect1custname[2]'. All of the other input
buttons, boxes, menus, and text would use the same naming conventions so
that the server side module can correctly process the data.
I am hoping to keep this as generic as possible so that we can add, change,
and/or delete entire sections simply by creating the appropriate HTML and
surrounding it with the correct <div> or <span>. I understand that there
may need to be some javascript wrapped around the checkboxes.
If you know of , or have, or can develop the code, please send particulars
to jscott4272 at comcast dot net. If there are any costs associated with
the code, just let me know what they are. If you have any questions or need
additional information, please email them to me.
View 2 Replies
View Related
Apr 12, 2011
I am terrible at regular expressions but is the best way on going about what I want to do, so please don't suggest a long winded if statement. I have a form with a promo code at the bottom, I want to validate the promo code using the following criteria in a regular expression:
Exactly 15 characters in the following order
1 letter, 4 letters or numbers, 5 letters or numbers, 3 letters or numbers, 1 number, 1 of the following 3 signs @ ! &
I want it to either accept it as a 15character string or as 3x5 character strings which is why I've written it out like this.
View 14 Replies
View Related
Oct 21, 2010
I have the checkbox validation. I have it set onClick, this works perfectly with both the mouse click and also if the space bar is used to select the option, which is great. However if a user simply 'tabs' over the option it doesn't validate real time. The solution I came up with was adding a onKeyDown event to trigger the same function.
Code:
<input type="checkbox" id="M_TERMS" name="M_TERMS" value="1" onClick="vldTERMS(this.id);" onKeyDown="vldTERMS(this.id);">
View 4 Replies
View Related
Mar 21, 2010
I am using a validating form plug in for jquery and I have a question about it. Let this function will be an ex.:
[Code]....
'e' is the name attribute of one form element, but can I choose more elements using jquery (CSS) rules like this: input[name*=e] or how can I do something similar?
View 5 Replies
View Related
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
Feb 3, 2011
I'm getting the following error in IE on my Adobe Presenter file: Message: Type mismatch: 'SlideContent_DoFSCommand'
What could be causing the error? The presentation plays fine, just getting the error.
View 1 Replies
View Related
Oct 12, 2010
I need a JS validation code for validating numbers such that,Empty space and characters(including + and -) shouldn't be allowed,there should be only one decimal point,spaces and characters between numbers also shouldn't be permitted.
View 6 Replies
View Related
Jul 23, 2005
I already understand that one cannot disable a browser's
forward and back functions. This is a situation where I
have code working in Mozilla V1.6 and would like something
similar for Opera and IE.
I link within a page and display individual divisions of
that page, manipulating their visibility and display styles
with an onClick function. As long as I explicitly click a
link to progress, it works with browsers I've tried.
If I click the browser's back button I see the content of
the browser's location bar change as I expect. But I
need to set the visibility and display styles for the
corresponding division. In Netscape/Mozilla I have a little
function enabled by setInterval(). It looks to see if
window.location.hash matches the division which is visible
and modifies styles accordingly.
Under IE window.location.hash seems to be "stuck" at the
most "forward" link. Under Opera I can get only the URL
without the hash; it claims that the hash property is
undefined or empty. I've tried document.location and
document.URL with the same results.
Since there's no page load or unload involved, there's no
event generated; I could kludge some history of my own to
traverse.
Am I looking in the right place to get the hash info? Is
there some direct access to read the location bar?
Is there another approach to the problem, other than breaking
up the page so that I force a load or unload?
View 5 Replies
View Related
Aug 31, 2010
Why my email field is validating, but mycode for validating empty fields is not?
View 1 Replies
View Related
Jan 17, 2010
There is a missing part on my program, it is when you input less than or equal to 65 and greater than 100, a prompt will appear and say "Invalid Entry" and ask you to Input again an entry until you enter a valid entry. For example on Prelim Grade, I input 50, a prompt must appear to say "Invalid Entry" and ask me to input again another entry. Another is how will I terminate the program? When I input an invalid or a valid entry, it is continuing to ask me to input again an entry.Here is my code
Code:
<html>
<head>[code]......
View 2 Replies
View Related
Jun 2, 2009
I want to use php to determine if user is logged in and then run js to change the div's display to none based on login status, something like:
if ($loggined) {
document.getElementById.('header').style.display = 'none';
}
js is so much more difficult than php!
View 4 Replies
View Related
Apr 9, 2010
I am looking to write some code that, once the window is closed, it runs some extra JS which loads a *.php file through an AJAX call. In theory to me it sounds simple but for some reason I cannot get it working. I tried the "onload" attribute but then found that triggers with refresh and links (not good). I simply need the JS code to start running some other JS when the window closes.
Code:
<script type="text/javascript">
function doUnload() {
$.post("");
}
</script>
View 2 Replies
View Related
Dec 6, 2010
<?php
if($_SESSION['id'])
echo '<h1>Hello, '.$_SESSION['usr'].'! You are registered and logged in!</h1>';
else echo '<h1>Please, <a href="demo.php">login</a> and come back later!</h1>';
echo 'Should i find a new login'
?>
im trying to use this as a check to see if someone is logged in
View 2 Replies
View Related