Jump to content

Prestashop 1.7 Address fields Country select javascript problem


ukbaz

Recommended Posts

Hi - I have some javascript working in 1.6 Prestashop that displays a message beneath the drop down when 2 specific countries are selected in the drop down.

I've tried editing this to work in Prestashop 1.7 by adding the amended code into /classic/templates/partials/form-fields.tpl

It works, I see the correct text briefly then it reflows and disappears!

Can anyone point out why this is happening and suggest a solution?

Code here:

        {block name='form_field_item_country'}
          <select class="form-control form-control-select js-country" name="{$field.name}" onchange="showhide(this)" {if $field.required}required{/if}>
            <option value disabled selected>{l s='-- please choose --' d='Shop.Forms.Labels'}</option>
            {foreach from=$field.availableValues item="label" key="value"}
              <option value="{$value}" {if $value eq $field.value} selected {/if}>{$label}</option>
            {/foreach}
          </select>
        {/block}
<!-- Added Pass to distributor code -->
		<div>
			<div class="answer21 answers" style="width:600px;height:30px;display:none">
			<div id="value21a"><strong><font color="#df242b" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Your order will be passed to our local distributor.</font></strong></div>
			</div>
		</div>
			<div>
			<div class="answer24 answers" style="width:600px;height:30px;display:none">
			<div id="value24a"><strong><font color="#df242b" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Your order will be passed to our local distributor.</font></strong></div>
			</div>
			</div>

			<script type="text/javascript">
 			{literal}
			function showhide(id) {
    			var mySel = $(id).val()
    			$('.answers').hide()  
    				$('.answer'+mySel).show()  
					}
					{/literal}
					</script>
					<!-- END Added Pass to distributor code -->

Help! :)

 

Thanks

Baz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...