Jump to content

Warning if no address is entered


Mark1

Recommended Posts

I need to prevent anyone performing a search using the advanced_search_map module from returning all results if no address is entered.

 

This is a 2.4 site that I have just upgraded from 2.3, where I used to use this Javascript to alert the visitor to enter a value:

 

 {jr_postcode}  <button onclick="if(jQuery('#jr_postcode').val()==''){alert('Sorry, you must enter a postcode or town to perform a search'); return false;} else jQuery(this).parents('form:eq(0)').attr('action',s2AjaxUri).submit();" class="jrButton"><?php __t("Search");?></button>

 

Here is the HTML section from the from my newly updated theme file:

 

/**********************************************************************************
* 						EDIT HTML BELOW THIS LINE
**********************************************************************************/?>

<div class="jr-page jrPage jrAdvSearchModule jrRoundedPanel jrForm">

<form class="jr-form-adv-search-module" action="<?php echo cmsFramework::getCurrentUrl();?>" method="post" data-module-id="<?php echo $module_id;?>">

	<moduletheme>

	<div class="jrFieldDiv jrLeft">

		<?php __t("Address, Town or Postcode");?>: {jr_postcode}<br>
<strong>Enter your location</strong>
	</div>


	<div class="jrFieldDiv jrLeft">

		<button class="jr-search jrButton" style="margin:0;">

			<span class="jrIconSearch"></span><span><?php __t("Search");?></span>

		</button>

	</div>

	</moduletheme>

	<div class="jrClear"></div>

	<?php
	/**********************************************************************************
	 * 						EDIT HTML ABOVE THIS LINE
	 **********************************************************************************/?>

 

I've tried various methods, but none have worked. Please can you tell me how I can get the warning screen to work again?

Link to comment
×
×
  • Create New...