Portal | Homepage | Blog

Limiting the characters in the customer comment box on the checkout page



Is it possible to limit the number of characters on the checkout page’s customer comment box?

I can see at present it is set to 200 characters:

<input class="textbox maxwidth" type="text" size="20" maxlength="200" name="checkout[comment]" value="" id="checkout_comment">

We’d like to limit it to 30 characters.



Hi Dan,

You could add this code to your Footer template:

{if (pageproperty[‘pageid’] eq ‘checkoutstep2’)}
$(’#checkout_comment’).attr(‘maxlength’, 30);
If you’re not comfortable adding it yourself, we can add it for you.



Hi Donogh,

That worked a treat.

If you can edit your post or if anyone else wanting to use the above remember to add in {endIf} to close the if statement.

Thanks for your help.


Hi Dan,

I’ve updated that - good spot!



For others reading, you can use a similar method to substitute the input box to a multi-line text-area which might prove a little more user friendly for customers wishing to leave detailed order notes.

{if ( (pageproperty[‘pageid’] eq ‘checkoutstep2’) )}

<script type="text/javascript">
$('#checkout_comment').replaceWith('<textarea cols="80" rows="3" name="checkout[comment]" value="" maxlength="200" id="checkout_comment"></textarea>');