WordPress.org

Support

Support » Plugins and Hacks » [Resolved] If custom_field is checked, redirect

[Resolved] If custom_field is checked, redirect

  • 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?

    http://wordpress.org/plugins/speakup-email-petitions/

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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

    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…

    solved…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] If custom_field is checked, redirect’ is closed to new replies.