Jump to content

javascript stopWithAlert not working with html query string


learningcurve
Go to solution Solved by learningcurve,

Recommended Posts

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
Share on other sites

  • Solution

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.