1

I am having trouble with my form. I have four questions and if any of them are NO, then I need the user to be directed to a "not eligible" type response. However if all of the answers are YES, then I need the user to be directed to another form to complete a consent to participate.

There is a simple variable fix, but for the life of me I cant get it to function...help please!

{exp:freeform:form 
    form_name="application_SANmeter_Eligibility" 
    required="name|email|phone1|user_birthday|services|address_1|gender|language" 

    // IF ALL ANSWERS ARE YES, THEN THIS IS WHERE I WANT THEM REDIRECTED
    return="http://www.xxxx.org/index.php/translational_research/digital_medicine/SANmeter_index/SANmeter_Consent/" 

    // IF ANY ANSWER IS NO, THEN THIS IS WHERE I WANT THEM REDIRECTED
    return="http://www.xxxx.org/index.php/translational_research/digital_medicine/SANmeter_index/SANmeter_NotEligible/"

    notify="xxxx@xxxx.org" 
    template="SANmeter_Eligibility_Response"
}
2

According to the docs, you can have a selection option that uses different returns. (Source: http://www.solspace.com/docs/freeform/form/ ) Here's their example:

<select name="return">
    <option value="application_form/thank_you">
        I will pay at the door
    </option>
    <option value="application_form/payment">
        I will pay now
    </option>
</select>

So you can move the return out of the {exp:freeform:form} tag and into the body of the form. I'd like make the field a hidden field, and then use some javascript to set the option value based upon the selection...

| improve this answer | |
  • Thanks @SamC! So I do have this type of option farther down where my questions are located. Is there somewhere within this that I should be including the return value? <p><label><h3>1. Are you 18 years of age or older?<span class="required">*</span></h3></label> <select name="services[]" /> <option value="">-- Select One --</option> <option value="Yes">Yes</option> <option value="No">No</option> </select> </p> <hr /> – Katrina Schreiber Feb 6 '14 at 22:41
  • Not sure it matters all that much, as long as it goes in the form somewhere. I was thinking about this further. Do you need the submissions from the not-eligible people? Because you could simplify and add a jquery validation tool - non eligible people would get an error message. And you'd only get the submissions form from eligible people. – SamC Feb 7 '14 at 19:02
  • Hi there! We don't need their info if they are not eligible. They could get a message that (instead of an error) would let them know they are ineligible. Where would I place a jquery validation tool? body, head, form? Thanks! – Katrina Schreiber Feb 7 '14 at 21:26
  • Ah. Then you probably can simplify a bit, and only use the one return link. Let me post it as a separate answer. – SamC Feb 10 '14 at 16:14
2

Alternative solution: use a jquery validation tool instead of multiple return options. If all fields have valid solutions (i.e. all are "yes"), then you collect the contact info. If not, they get an error message.

There are tons of options if you search for "jquery validation" like this one: http://validval.frebsite.nl/

Define what a "valid" response is, and then any non-valid response gets an error message. (also defined by you)

I spy a lot of "freeform validation" questions on stack exchange. Maybe look and see if one of those has a more specific recommendation.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.