SpeakUp! Email Petitions
[resolved] If custom_field is checked, redirect (4 posts)

  1. owenw
    Posted 2 years ago #

    Hi All,

    I'm trying to redirect users who click on the custom_field checkbox input.

    Previously I setup a redirect in the ajax.php file that altered the success message to send people to a new landing page.

    Now i need to change it so that only people who check the "custom_field" box (which i changed to be a checkbox from text input), get redirected.

    Anyone able to help with this? Where should i handle this redirect? Unfortunately the $signature->custom_field that AJAX.PHP reads, only says "on", meaning I've enabled the custom field... but how do I get the fields value?


  2. owenw
    Posted 2 years ago #

    Still working on this. Seems adding a value to the checkbox works to carry that value over into $signature->custom_field, regardless of if the box is checked... so getting somewhere... sorta

  3. owenw
    Posted 2 years ago #

    Solved. Was getting all confused working inside ajax.php when I should have been messing with public.js. Now the redirect happens at javascript level based on a success response from the ajax.

    Note that i changed the form field "custom-field" to be a checkbox (in emailpetition.php). And then I added this statement (inside public.js) to see if the checkbox has been ticked:

    if ( $( '#dk-speakup-custom-field-' + id ).attr( 'checked' ) ) {
    window.location.href = "http://new.url";

    Just adding this in case someone else tries to redirect a user based on a field value in the petition...

  4. owenw
    Posted 2 years ago #


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • SpeakUp! Email Petitions
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic