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.

Paragraphs showing up in conditional logic javascript

  1. All,

    I'm using a theme called Nexgen with Gravity Forms. For some reason, when using this theme with conditional logic, it inserts <p> into the javascript and messes up the form:

    http://pastie.org/1002210

    Does anybody know I can solve this? The <p> is not there when I switch to the default wordpress theme.

    Here is the link to the actual site: http://pcsreports.com/pcs_survey/

    Thanks,
    Casey

    Posted 13 years ago on Sunday June 13, 2010 | Permalink
  2. I would assume something in this theme is adding the additional markup - probably from something in the functions file.

    I can't know without seeing it.. can you provide a URL for the theme so I can download it and take a peek?

    Posted 13 years ago on Sunday June 13, 2010 | Permalink
  3. Kevin,

    You are right! I looked in the functions file and found a reference to "short codes." I commented out that line and now the form works. Hopefully I can figure out which short code is causing the problem, as they are useful. But for now I'm glad to have fixed this problem!

    Thanks,
    Casey

    Posted 13 years ago on Sunday June 13, 2010 | Permalink
  4. Specifically, I found this function to be the problem:

    /*// DISABLE AUTOFORMATING POSTS
    function my_formatter($content) {
    	$new_content = '';
    	$pattern_full = '{(\[noformat\].*?\[/noformat\])}is';
    	$pattern_contents = '{\[noformat\](.*?)\[/noformat\]}is';
    	$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
    	foreach ($pieces as $piece) {
    		if (preg_match($pattern_contents, $piece, $matches)) {
    			$new_content .= $matches[1];
    		} else {
    			$new_content .= wptexturize(wpautop($piece));
    		}
    	}
    	return $new_content;
    }
    remove_filter('the_content', 'wpautop');
    remove_filter('the_content', 'wptexturize');
    add_filter('the_content', 'my_formatter', 99);*/

    Is there a way I can fix it so it works with Gravity Forms? Or is it really doing anything useful?

    Thanks,
    Casey

    Posted 13 years ago on Sunday June 13, 2010 | Permalink
  5. Casey,

    It appears that this creates a shortcode where you can wrap content in a [noformat] [/noformat] tag and the content inside won't be auto-formatted by the WordPress "wptexturize" and "wpautop" filters. ( auto p tags). It could be handy if you do a lot of advanced formatting inside of a post.. otherwise, it's not really a necessity.

    It looks very similar to something I've used before, and if I recall, this snippet played nicely with Gravity Forms. I'm not entirely sure what might be different, but if you really need that functionality, you can check this out and maybe work with your theme developer to find out what's causing the issue.

    http://www.wprecipes.com/disable-wordpress-automatic-formatting-on-posts-using-a-shortcode

    Posted 13 years ago on Sunday June 13, 2010 | Permalink
  6. Cool, I think I'll just leave it alone. Again, thanks for fixing my problem!

    Casey

    Posted 13 years ago on Sunday June 13, 2010 | Permalink

This topic has been resolved and has been closed to new replies.