WordPress.org

Ready to get started?Download WordPress

Forums

Fast Secure Contact Form
Form not submitting on Blackberry (12 posts)

  1. Sabrina Morgan
    Member
    Posted 3 years ago #

    My contact form is not submitting in Blackberry browsers (with JavaScript enabled, default user agent). With all fields filled out, when I press the Submit button the page does not submit or refresh but jumps to the top of the contact form. No error message is received.

    Does anyone know what's going on, and is anyone else experiencing this bug also?

  2. Mike Challis
    Member
    Plugin Author

    Posted 3 years ago #

    I have an iPhone, not a BlackBerry.
    But a URL to your form would be very helpful for anyone to help you.

    Mike

  3. SpankMarvin
    Member
    Posted 3 years ago #

    I was searching the forums earlier today about this issue, then I worked out what the problem was.

    It's an issue with how the Blackberry seems to interpret the action attribute of a form tag, when the action has reference to a named anchor.

    Check the source code generated by si-contact-form, and you'll notice the action adds #FormID -- whatever that form ID is. This led to the clicking of the submit button simply jumping to the top of the form rather than actually submitting. This does seem isolated to Blackberry browsers.

    The (less than ideal) way I have solved this is to remove the # addition from the plugin. Open si-contact-form-display.php and remove that reference from around lines 34 and 42. That should fix it. I say it's not ideal because I guess that updating the plugin in future will restore the old code and reintroduce the issue. Still, it gets it working...

    Good luck

    John

  4. Mike Challis
    Member
    Plugin Author

    Posted 3 years ago #

    The #FormID serves a purpose of putting focus back on the form after submit. It is called a HTML anchor link. This is most useful if the form is on a long page or if there is more than one form on a page.

    This is really a blackberry bug that should be reported / fixed by blackberry.

  5. SpankMarvin
    Member
    Posted 2 years ago #

    It's totally Blackberry that's at fault, but would it be a bad thing to try to override the anchor linking in the event that there is not a great deal of content to skip past to get to the form? Adding a content filter after the form turned out to be the least destructive method for me. I'd sooner have said screw Blackberry, but the client wouldn't let me ;)

    add_filter('the_content', 'remove_si_anchors', 100);
    
    function remove_si_anchors($content){
    	$content = str_replace('#FSContact1','',$content);
    	return $content;
    }

    Apart from the obvious inability to snap to the form on submit, are there any other pitfalls I'm overlooking by applying something like that?

    Cheers!

    J

  6. Mike Challis
    Member
    Plugin Author

    Posted 2 years ago #

    It looks like it would work, the only thing is if they add anymore forms then you have #FSContact2, #FSContact3, #FSContact4, etc.
    So a preg_replace would be better
    $content = preg_replace('/#FSContact\d+/','',$content);

  7. SpankMarvin
    Member
    Posted 2 years ago #

    Good call on preg_replace, should have thought of that, thank you!

    J

  8. westsidestory
    Member
    Posted 2 years ago #

    Morning.

    I have the same issue.
    Did this solution resolve this?
    If so, could you be so kind and let me know where exactly i need to ad the code specified above?

  9. SpankMarvin
    Member
    Posted 2 years ago #

    Hey

    Incorporating the preg_replace into the filter and function, you get:

    add_filter('the_content', 'remove_si_anchors',100);
    
    function remove_si_anchors($content){
    	$content = preg_replace('/#FSContact\d+/','',$content);
    	return $content;
    }

    Place this in your functions.php file in your theme. This works well if you need to get over the Blackberry bug.

    J

  10. westsidestory
    Member
    Posted 2 years ago #

    Thank you.
    I appreciate your assistance and will give it a try.

  11. Mike Challis
    Member
    Plugin Author

    Posted 2 years ago #

    It would be nice to detect the Blackberry browser and conditionally apply the function. Even nicer would be for Blackberry to fix the bug.

  12. westsidestory
    Member
    Posted 2 years ago #

    Agreed. BB's issue is causing a bit of grief on my side and it doesn't appear they are paying any attention to this issue.
    Do you by any chance know if anybody using Contact Form 7 has had the same issue and managed to resolve it?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic