Alter Length of textbox ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
J#xx
Forum Newbie
Posts: 6
Joined: Wed Feb 04, 2009 2:30 pm

Alter Length of textbox ?

Post by J#xx »

Hi, i'm a little bit stuck with this one. I need to reduce the length of a text box from 15 to 6, I tried various things i've found on google about the subject but nothing works. here's the code....

Code: Select all

<?php echo zen_draw_input_field('lsphere', $account->fields['customer_lsphere'], 'id="lsphere"') . (zen_not_null(ENTRY_LSPHERE_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_LSPHERE_NUMBER_TEXT . '</span>': ''); ?></span></td>
The database for this field is set to 6 but the box allows up to around 15, is it possible to change the amount of digits in the box ?

Cheers
J#xx
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Alter Length of textbox ?

Post by jayshields »

I don't know how your function works, but you need a maxlength attribute in your input tag. Maybe change 'id="lsphere"' to 'id="lsphere" maxlength="6"'?

You should not rely on this method for data validation though, you should also check the length on the server-side.
Post Reply