Announcement

Collapse
No announcement yet.

Making Vat Number Entry Field 'Not Required'

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Making Vat Number Entry Field 'Not Required'

    On Checkout Page 1 I want to be able to have the checkbox to select that the order is VAT exempt but I do not want to show the entry box for the VAT number to be filled into. So far I have done this by simply changing the INPUT type from TEXT to HIDDEN.

    The problem is that when the checkbox is ticked this hidden number entry box becomes 'required' and I can't find where to deselect it as being 'required'.

    Does anyone know where this can be changed or alternatively know of a way prepopulate the now hidden field with some fixed text to allow it to pass on to the next checkout page without needing a user input into the field.

    Hope that makes sense.

    #2
    I'm using v10 and strangely i don't have a required attribute attached to the input upon checking the check box. I've assumed this is a javascript change, so I've put together a javascript option. Not sure this is exactly what your after but could you:
    1. change the input back to a text field
    2. use javascript to convert it to a hidden field or simple hide it (personally i'd probably just hide it)
    3. upon the user ticking the VAT exempt option use javascript to show the field so they can enter their VAT number ( if applicable ), javascript could also remove the required attribute so if they don't fill it in it's not a problem


    this way the field is visible by default only to those with javascript disabled and you have the ability to receive the customers VAT number if they have one. Of course you could you could just remove the required attribute via javascript when they tick the box and leave it hidden but i thought this might be more useful.

    I use JQuery alot so the code I'm putting below utilises this, it's completely possible without just easier for me to write off the top of my head.

    Code:
    $('#exemptInput').hide();
    	
    $('#exemptCheckbox').click(function() {
    	$("#exemptInput").removeAttr("required").toggle(this.checked);
    });

    Hope this is of some help.

    Regards,

    Guy
    Regards,

    Guy

    Lead Developer - Lock Shop Warehouse
    Offering discounted padlocks, and a huge range from the best door lock suppliers, all alongside other essential security products.

    Comment


      #3
      The required attribute is not actually in the styling (or in fact shown in the page code at all) it is the checking after the page is sent to the server - so the checking is in the scripts I assume.

      What I have seen is that this line that I now have in Actinic:
      <input type="hidden" name="TAXEXEMPT1DATA" size="30" value="<actinic:variable name="TaxExempt1Data" />" />
      actually shows online as
      <input type="hidden" value="" size="30" name="TAXEXEMPT1DATA">

      ie with the value as null.

      I'm going to try this to see if it will populate the value field and then pass that on page submission with this
      <input type="hidden" name="TAXEXEMPT1DATA" size="30" value="Outside the EU" />

      UPDATE: This change has worked.

      Comment

      Working...
      X