learningcurve Posted April 15, 2013 Share Posted April 15, 2013 I have a form I am using. You can access this form from two different urls. url1.com/form.php and url1.com/form.php?invited Depending on the url used to access the form, I have a section either show or not show. The code for this is: <?php if (!$invited) echo '<p><strong><input type="checkbox" id="infocheck" name="infocheck" value="Yes" > Verification Statement: "I verify that I have followed the proposal guidelines above and that my proposal includes citations of relevant literature and a reference list in APA format, a discussion of evidence of learning outcomes, and a description of how the session will be run."</strong></p>'; ?> What I am having trouble with is a stop alert for verification in my javascript. I currently have: if (realForm.infocheck.checked == false) {return stopWithAlert("Please read and agree to verification statement.", realForm.infocheck);} How do I tell this to only do this if that section of the form is available and checked? When visible it has to be checked to proceed, when not visible (ie for an invited person with ?invited in the query string, I don't want it to even check. Javascript is not my strong point. Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/276980-javascript-stopwithalert-not-working-with-html-query-string/ Share on other sites More sharing options...
learningcurve Posted April 16, 2013 Author Share Posted April 16, 2013 Problem resolved! At one point it enters invited as a hidden value so all I did was change the stop alert line to: if (realForm.type.value != "invited" && realForm.infocheck.checked == false) {return stopWithAlert("Please read and agree to verification statement.", realForm.infocheck);} Works like a charm! Link to comment https://forums.phpfreaks.com/topic/276980-javascript-stopwithalert-not-working-with-html-query-string/#findComment-1425080 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.