473,657 Members | 2,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

user input box: first 2 characters as a read only value

<input type="text" size="7" name="test" maxlength="4" value="4Tyourna me">

Is there any way I can make first 2 characters as a read only value?
Jul 20 '05 #1
3 7248
"reneeccwes t" <re*********@ho tmail.com> wrote in message
news:9f******** *************** ***@posting.goo gle.com...
<input type="text" size="7" name="test" maxlength="4" value="4Tyourna me">

Is there any way I can make first 2 characters as a read only value?


Of course not, but you could simulate that strange behaviour, something like
this:

<input value="4T" size="2" style="margin-right:none; border-right:none;
text-align:right;"
onfocus="docume nt.getElementBy Id('yourname'). focus()"><input id="yourname"
style="margin-left:none; border-left:none" value="yourname ">
Jul 20 '05 #2
reneeccwest wrote:
<input type="text" size="7" name="test" maxlength="4" value="4Tyourna me">

Is there any way I can make first 2 characters as a read only value?


If it really is read-only, then make it read-only:

<style type="text/css">
span.outline {
font-family: monospace;
border: 2px inset;
}
@media screen,print {
span.outline {
padding: 1px;
}
input.noBorder {
font-family: monospace;
border: none;
}
}
</style>
<form>
<input type="hidden" name="testHidde n" value="4T">
<span class="outline" >4T<input type="text" size="9" name="test" maxlength="8"
value="yourname " class="noBorder "></span>
</form>

When the submitted data arrives at the server, concatenate the contents of
testHidden and test together.

Of course it doesn't look so hot in Netscape 4.x, but it's not completely
unusable, and in more modern browsers you get a funky input box where the
first two characters appear to be "read-only". The only browser I'm really
disappointed at is Opera 7.11. It refuses to honor border:none on the input
element.

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #3
Is it possible to remove the space from the left side?
There is a space before "4T"

"Vjekoslav Begovic" <vj*******@inet .hr> wrote in message
news:bj******** **@sunce.iskon. hr...
"reneeccwes t" <re*********@ho tmail.com> wrote in message
news:9f******** *************** ***@posting.goo gle.com...
<input type="text" size="7" name="test" maxlength="4" value="4Tyourna me">
Is there any way I can make first 2 characters as a read only value?
Of course not, but you could simulate that strange behaviour, something

like this:

<input value="4T" size="2" style="margin-right:none; border-right:none;
text-align:right;"
onfocus="docume nt.getElementBy Id('yourname'). focus()"><input id="yourname"
style="margin-left:none; border-left:none" value="yourname ">

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3069
by: reneeccwest | last post by:
Different user input boxes are automatically populated based on a value of the dropdown box. Can anyone help me on that?
9
2534
by: refer_to_website | last post by:
My VB.NET web application has a textbox where the user is allowed to enter up to 50 characters. I have a label on the form next to the textbox that tells the user how many remaining characters he can enter. This label needs to be refreshed on the fly each time the user types a character into the text box. Eventually, the user will click the SAVE button on the web form, and the data he entered in the text box will be written to the...
4
9438
by: jas | last post by:
I have a basic client/server socket situation setup....where the server accepts a connection and then waits for commands. On the client side, I create a socket, connect to the server...then I pass the socket to a class which just reads from the socket (in a thread). class Reader(Thread): def run(self): while 1:
2
5072
by: der | last post by:
Hello all, I want to use fgets() to read lines. Now, if the user has entered more characters than it was supposed to, the next call to fgets() would read these characters, which I don't want to be read, but rather reading fresh new line instead. How should I deal with such scenario?
4
3869
by: santa19992000 | last post by:
can I use scanf to get input (some times user enters input sometimes not, just hit keyboard)?. It displays to enter IP address, if user wants to change, then he enters, otherwise he hits keyboard, which should prompt next one, how can I do in C program?. Thanks. enter IP address:
6
7606
by: karthi | last post by:
hi, I need user defined function that converts string to float in c. since the library function atof and strtod occupies large space in my processor memory I can't use it in my code. regards, Karthi
2
8123
by: Rajen | last post by:
Suppose the field length is 25 characters. After entering the 25th character, it should be available to process. Program should not wait for the user to press enter/return key. Thank you.
1
3236
by: kang jia | last post by:
hi when user entered particulars in signuppage and click" signup" button, i will direct them to do_signup.php. if say the NRIC is dupicate in datebase, i will redirect them back to signup page again to re-signup, however, i would like to remain all the correct infromation, and let users re-entered their NRIC. how can i do this. can i use Session, but it seems cant work. any one can help me? my code in signup page is like this: ...
14
2398
by: n3o | last post by:
Hello Comp.Lang.C Members, I have an issue with user input that I have been trying to figure out for the longest. For instance, let's say you have something like this: void foo() { int num; printf("Please enter a number: "); scanf("%d", &num); // yes I know this function may throw a
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8502
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7316
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.