View Full Version : Partialy disabled text feild
03-05-2005, 05:36 AM
Is it possible to have a text field with '2005' in it, but only the '05' is changable, and the '20' is disabled, (read only)
03-05-2005, 12:20 PM
Not as far as I know of... although there are a couple of other ways to accomplish a similar effect. How about having the 20 outside the text box? Like so:
20<input type="text" name="year" value="05" size="2" maxlength="2"/>
That way you'll still have the text there and the user still knows it needs to be a 20-- year. This is the way I'd recommend you go...
Otherwise, you could use a select box with all the years 2000 - 2099 in. The disadvantage is that it's gonna end up a huge box... but you do limit the responses that the user can provide.
But, if you're still not content with either of the above solutions and still wanted the 20 to appear to be in the same box as the text you could stick it in there as a background image and then apply some padding to the text box so they cant type over it. Alternatively you could relatively position some the 20 in there like this:
<input type="text" name="year" value="05" size="4" maxlength="2" style="padding-left: 20px;"/>
<div style="position: relative; left: 5px; top: -20px">20</div>
This is not a very user friendly approach as the user will think that they can edit the text when really they cant as it's an image anyway... but it's entirely up to you.
Let me know if that helps or if you have any further problems.
03-07-2005, 01:41 AM
Sorry i didnt reply soon. I needed to set my computer back up after a LAN, and was limited to one hand. I will try the image solution. I think it could be user friendly if its greyed out. ill Let you know.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.