Support » Plugin: Simple Locator » Malformed HTML Breaks AJAX Form

  • Hello,

    I think this may be a bug.

    In views\simple-locator-form-ajax.php there’s a conditional for allowemptyaddress. The problem is once this is true there’s no space between the class attribute and the form declaration. What you end up getting in the HTML output is:


    This then prevents the jQuery from finding the form and appending the security nonce. Without the nonce there’s no form processing and a generic error is returned. This needs updated to include a space in the conditional:

    if ( isset($this->options['allowemptyaddress']) && $this->options['allowemptyaddress'] == 'true' ) $output .= ' class="allow-empty"';

    – – – – – – – – – –

    Luckily, you did provide a filter to manage the form HTML which is super neat! A quick fix for other readers is to simply filter the HTML and make the replacement like so:

     * Modify the locator form output
     * @param String $output
     * @return String $output
    function uniqueprefix_wpsl_form_output( $output ) {
    	$output = str_replace( 
    		'form class=',
    	return $output;
    add_filter( 'simple_locator_form', 'uniqueprefix_wpsl_form_output' );
  • You must be logged in to reply to this topic.