-1

Ok so I have a function that should make a button enabled if the requirements are met and they are.

Here is the method:

function CheckToEnableSubmit()

{

var Credit = ValidateCreditCard();
var Name = ValidateName();
var PPSN = ValidatePPSN();
var Phone = ValidatePhone();



var Size = SizeSelected();
var Flavour = FlavourSelected();
var Icing = IcingSelected();

if (Credit && Name && PPSN && Phone) 
{
    document.getElementById("submit").disabled = false;
} else {
    document.getElementById("submit").disabled = true;
}


}

and the JFiddle:

http://jsfiddle.net/UTtxA/51/

I will give correct answer to the best explantion of why it is not working.

if you want to test use:

-The name field "ggggg ggggg"

-phone "0854444444"

-credit "4716756572491904"

-ppsn "5555555j"

2
  • HOW is it not working? What exactly is your expectation vs what is actually occuring? Commented May 7, 2013 at 6:08
  • there is no element with id 'submit' Commented May 7, 2013 at 6:09

1 Answer 1

2

Your fiddle is throwing an error in the console, that is why it is not working

Uncaught TypeError: Cannot set property 'disabled' of null

You don't have id for the submit button

<input type="submit" id="submit" value="Place Order" onclick="" disabled>

Demo: Fiddle

Sign up to request clarification or add additional context in comments.

2 Comments

@johnny you need to check the browser console
@johnny F12 to see the developertools in Chrome

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.