Created
November 4, 2013 12:19
-
-
Save jonmunson/7301706 to your computer and use it in GitHub Desktop.
Validation script to determine a "checkbox" state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Validation for Sponsor in Application Edit/Show | |
function validate(){ | |
var hasSponsor = document.getElementById('hasSponsor'); //check box ID | |
if (hasSponsor.checked){ | |
sponsorUrl = document.getElementById('sponsorUrl'); //sponsor URL field ID | |
sponsorImage = document.getElementById('sponsorImage'); //sponsor Image field ID | |
if ( sponsorUrl == null || sponsorUrl == "" ) { | |
alert("You need to enter a Sponsor URL") | |
} | |
if ( sponsorImage == null || sponsorImage == "" ) { | |
alert("You need to specify a Sponsor Image") | |
} | |
console.log("There is a Sponsor!!!") ; | |
} else { | |
console.log("There is no Sponsor...") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment