I have a signup form on my site..when the user clicks the signup button, I am using a little script to check the form and make sure it's filled out correctly. I know i'm calling the script right because I did some error checking/debugging but it isn't actually doing its job.
Further more, I tried a quick alert to see the value of my variable, returned and I get an alert that reads "[object nodes list]".
Here's my script
<head>
<script type="text/javascript">
function chk_Empty(){
alert("working");
i'm trying to use a regular expression to verify an order. I basically don't want any decimals or negative numbers allowed. I believe I have any digit 0-9 one or more times and negating decimals. but for some reason it allows decimals and letters. also is it correct to put return true or can i just leave it blank?
var varifyThree = /^\d*[^\.]$/; var productThree = document.getElementById('prod3').value; if (productThree==null || productThree=="" || varifyThree.test(productThree)) { return true;
I keep getting an error that says item is null. I'm a little lost because once I got my regExp to start working this actually worked for a little bit. When I came back I was getting an error.
var creditExp = /^([345])(\d{3})\-?(\d{4})\-?(\d{4})\-?(\d{4})$/; var creditNumber = document.getElementById("creditnum").value; var item = creditExp.exec(creditNumber); document.getElementById("creditnum").value = item[1] + item[2] + "-" + item[3] + "-" + item[4] + "-" + item[5]; if (item[1] == 4 && document.getElementById("card1").checked == true) { return true; }else if (item[1] == 5 && document.getElementById("card2").checked == true) { return true; }else if (item[1] == 3 && document.getElementById("card3").checked == true) { return true; } else { alert("You must enter a valid credit card number."); document.getElementById("creditnum").focus(); return false; } var billingName = document.getElementById('creditname').value; if (billingName == null || billingName == "") { alert("You must enter your first name as printed on your credit card!"); document.getElementById('creditname').focus(); return false; }
I have a question here. I have 2 videos and if I click the image which uses #usemap, it will switch to the specific videos I clicked. FF and chrome has no problem but only IE.
The scenario is like this: Actual scenario is when the page load, it will display tab 1, video 1 and tab 2 is greyed out. If I clicked on tab 2, tab 1 is greyed out and video 2 is display. Both tabs I use #usemap.
But now the problem in IE is that it keeps on displaying tab 1 and video 2 instead of video 1 and when I clicked tab 2, tab 2 is selected but no video is loaded. Below is a simple code which hope it can helps better understanding of what I'm trying to do:
IE just keep displaying video 2 when page load and video doesn't loads when tab 2 is clicked. Even if I program the 2 divs to be show, it only shows video 2 and video 1 is nowhere to be seen. And I tried taking out the video 2 codes, video 1 then can be seen.
I'm having a problem with my radio buttons. On FF and Chrome they work just fine, but in IE, they does'nt appear as sellected. In other words: they do their job, but when you click'em, they stay unckeched. The genetarion code:
var item = $('<input type="radio" />').attr('value',pid).attr('name',name); self.append($('<p />').append(item).append('<label>'+desc+'</label>'));
I've got this page with some simple numerical validation : [URL].. but when the number you enter into the input fields are 100 or over the validation fails.
I have a simple three-field form in a UI Dialog that, prior to POSTing, I need to validate using the jQuery Validation plugin.Currently, if the user clicks the form's Submit button (the form's action for the PHP form handling is the page with the link that opens the Dialog in the first place) with a field not properly filled out, the Dialog just closes.Clicking again on the link that opens the Dialog form will show the form with the error message(s) that the Validator generated on the previous click of the submit button.How can I keep the Dialog open and prevent a POST until the form validates?
I know it's messy and all to send data this way, but it's what was decided on, so here's what I need to do with it. I want to take all the info from the query string and post it into the corresponding form fields in the document. So I need to somehow isolate the query string (maybe a global JS variable? maybe another method?) and then I was thinking it would work to somehow pull each piece of information delimited with &= and put them into a simple array (split() method?). Once I have the info pulled from the URL into an array, I thought I could simply update the field's value attribute with basic javascript like this:
form1.SubscriberID.value=1523;
Then, all the values would be automatically loaded into the correct form fields. But, since I'm a js newbie, I really dont know how to go about this. Ideas? Examples? Remember I'm new, so explaining every process might be in order.
I have created a snippet of javascript code that will do the following:
1. read the window URL 2. depending on the window URL, a word will be placed into a hidden form field. 3. Person submits form...etc., etc.
Here is what I have.
Let's say that I have a single landing page with a simple form on it. I would like to reference the referred URL by pulling a part of the window URL into a hidden field of the form. Let's say the three URLs are:
[URL]
I have created a javascript that takes the exact URL and check for equality. If the URL is equal, it will place the corresponding id into the hidden form field. See my code below.
<script type="text/javascript"> var lead_source = window.location.href { if (lead_source == "http://www.whatever.com/index.htm?id=ref1")
[Code]....
What I am looking to do is modify the code to only look at the "id" variable, not the entire URL. That way, if I add any additional items to the URL I will not have to change the code. I guess I am looking for an extra step of parsing the URL...maybe.
what i want to do is have a selection from 'tst' trigger an input into 'choose' from the data inputted into the 'fname' and 'lname' fields.
for example, i want option '1', when selected to draw the input from 'fname' and place it into 'choose'
or i might want to select the data in 'lname' instead, so i will tie option 2 to it, so when the user selects option 2 the contents of 'lname' go into 'choose' instead.
I have some form fields that the user can either type in or he can check a checkbox so that MySQL data for an option selected from a dynamically generated (PHP/MySQL) select menu is filled in. How can this be implemented? I have the code for the select menu.
I have to build a small contactform validator in JS, which checks the fields' values when submit is clicked. I am experiencing problems with getting the email validation to work properly. This is what I've got:
When I don't fill in anything in the email field, I indeed get the proper alert. But when I fill in a string between 1 and 7 characters, the (document.contact.email.length < 7) is not met. The same goes for the last two conditions: (!document.contact.email.indexOf("@")) || (!document.contact.email.indexOf(".")). Even when (one of) these two conditions are not met, it is possible to submit the form...
I'm trying to get a form submit working for all browsers, and I am using document.forms['formname'].submit(). However, despite having 'formname' set on the forms in both the name and id properties, Safari 3 will not submit the form correctly; when I debug, $_POST is empty. IE, FF both work here fine. If I use document.forms[0].submit() it works correctly, but this code will be working in a dynamic site where I can never be sure at what index a given form will reside. I can make it work using document.getElementById('formname').submit(), but that does not work with js turned off, and I need this to work with js on/off.
I was about to sign up to .mac (www.mac.com) on my PC but when I went to free trial, it informed me that to get the trial, I would have to sign up using a Mac. I do have a Mac but I was wondering whether anybody could help me with the script for that.
What I would like is for someone on a PC to go to my site, and be given a customised message informing them that they can only browse the site using a Mac. I don't want a redirect, just something like the .mac system, but when somebody access's it on a Mac then the site will be displayed without a problem.
I have a html form which then pipes to a phpmail script to mail the information to myself, I would like to add some form of verification to ensure a user cannot just send a blank form.
Each field has a 'default' value which I think i could probably use to set a kind of check up such as if $blah == "default value here" die kind of effect..
I'm making a contest for a movie site and they want me to add age verification via a javascript call that will pop up a window if the user is under 18. I absolutely no clue where to start on this.
I am building a HTML file with a listbox/menu with 4 values in it. The page works fine on the first run and each time the list is clicked it displays the option selected. However it works the first time i click each of the four values and the second time i click an option it displays something else in the list. Can you figure out if the problem lies within my switch statement..??
function checkVal4(Val) { switch (Val) ............
i am following the example ajaxSubmit[URL].... here my code[URL]... i realized that the showRequest work correctly, shown all my form submit values But it doesn't respond "showResponse(responseText, statusText, xhr, $form)" is not execute. the respond prompt is not pop up
I've got the following code (from this tutorial:[url]
thisItem = $(this).attr('rel');
Then I create HTML for navigation:
And it works perfect but only when I use single category for rel="". In this case rel="abc" works and rel="abc abc2" doesn't work.
There must be something with $('.pf_item li[rel!='+thisItem+']') but since I don't know jQuery I can't solve it myself. I just want to change this line into something that is able to work with multiple attributes in rel.
I'm trying to select my textarea only if it is not empty. I have used :empty for this purpose. This works find when you load the page, however if you start typing in it still considers the value as it was when the page loads.
Example. If my textarea is empty when I load the page, it will consider it empty. If I starting typing in, and check if it is empty it still say it is empty.
The same vice versa. If my textarea has text when the page loads, then i clear that data, it still consider it filled not empty.