PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Firefox and isSelected issue

  1. brasofilo
    Member

    Trying to make a gform_pre_render manipulate a dropdown field and mark one as selected, it was not working... Until I swapped to Chrome and it was ok.

    Seems that this FF behavior is not new. It displays the last selected field after refreshing.
    http://stackoverflow.com/q/4831848/1287812

    I'm solving like this:

    add_filter( 'wp_head', 'gf_is_selected_firefox' );
    
    function gf_is_selected_firefox()
    {
    	if( !preg_match( '/Firefox/i', $_SERVER['HTTP_USER_AGENT'] ) )
    		return;
    	?>
    	<script>
    		window.onload = function() { document.forms['gform_5'].reset(); };
    	</script>
    	<?php
    }

    PS.: here, no detection is being made to only print this in the correct page where the form is being displayed.

    Posted 12 years ago on Saturday December 8, 2012 | Permalink
  2. Thank you for posting your solution. It appears that this is Firefox behaviour and is not new, as you mentioned. This is a good work around for now.

    Posted 11 years ago on Wednesday January 2, 2013 | Permalink