Jump to content

Recommended Posts

HTML has a "maxlength" attribute you should look into.

 

If you don't want the user to be able to change it at all, an input is perhaps not the best way to go. You could setup a bit of JavaScript on the element though to make it default back to a value when the user loosees focus on the input (onblur):

 

<input (...) onblur="this.value='EUF';" />

If you don't want the user to change the value from "EUF" at all, perhaps you shouldn't be using an input..?

 

If the input's there for some design reasoning, perhaps use the disabled attribute, or, you could use a hidden input and just write the text "EUF" normally?

I agree with the last. Just put EUF as text just before the input field, so the user knows to enter the EUF code without the EUF text. Then add EUF to the input on the server-side before you use it.

 

Something like:

EUF<input type="text" name="EUFCode" />

If you want it to look as if it's in the input field you could a big left padding on the input and position absolute for positioning the text over it. HTML forms do not (yet?) allow masked textboxes like those found in programming languages.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.