• Resolved Frisko

    (@frisko)


    Hi folks! The contact form on a client site has multiple subjects in a drop down list and I want to preselect one subject depending on where the user is comming from.

    Reading the “How To: Passing query string parameters to contact form page” this should be possible by simply passing [form number]subject_id=[number] as param. So my Link is something like blogurl.tld/contact/?1subject_id=1 (or 2,3,…).

    Unfortunately this doesn’t work…the first option is always selected no matter what I pass as ID in the query string!
    So I went into the code and I think I found the reason: The select is build in si-contact-form-display.php on line 373-411. On line 394 there is an if-clause which checks if the subject ID (sid) is set. If it’s not set and if we set the subject id in the query param the sid is extracted from the url. The thing is: sid is always set, because it is assigned ‘1’ as default on line 1016 in si-contact-form.php. That’s why the first option is always selected and the query string param doesn’t work for subject drop down list…

    You could unset the sid before the if-clause on line 394. That would make it work. Can someone confirm this? Is unsetting a solid solution?

    http://wordpress.org/extend/plugins/si-contact-form/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I will fix it properly. I will let you know when the fix is ready.

    Mike

    The download was fixed.
    If want this fix now, and the latest download version is still 3.1.7.2, manual upgrade will fix it
    http://www.fastsecurecontactform.com/update-to-the-latest

    Let me know if it resolves the problem

    Thread Starter Frisko

    (@frisko)

    Yes, the fix you provided resolves the problem!

    Thank you so much Mike. Great work! 🙂

    aundc

    (@aundc)

    i was glad to see, that the searched case i like to ask for a solution has been discussed one times before here. (sorry for my bad english)

    i tried to fix a problem for my needs like in the example above, but it won’t work:

    ok, for explanation:
    “The contact form on” my site has in a 3. “extra field” “multiple subjects in a drop down list and I want to preselect” the 7 subject “depending on where the user is coming from”.

    if i do write now for the just wanted url like this

    http://www.mysite/page_with_contact_form/?1ex_field3=7

    … but it will never show the in the seventh point of the drop down list written subject but always the first one.

    it seems i’m not able to choose the right way of URL Encoding.
    what should i write for this please?

    (using Fast Secure Contact Form Version 3.1.8.1 on WP 3.5.1 / Multisite)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Preselect subject in drop down: subject ID as query string param doesn't work’ is closed to new replies.