Jump to content
ukbaz

Prestashop 1.7 Address fields Country select javascript problem

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More