Jump to content

Recommended Posts

<input type="text" name="someName" readonly="readonly">

 

This would make the textfield readonly. The question is, is there some string such that <input type="text" name="someName" readonly=""> is NOT readonly? I tried false and empty string, but both of them still makes the textfield readonly

 

P.S.: I do know that not putting the readonly attribute will make the textfield NOT readonly

Link to comment
https://forums.phpfreaks.com/topic/150354-about-readonlyreadonly/
Share on other sites

Sorry about that, I accidentally used an html tag..

 

Let me repost:

 

<input type="text" name="someName" readonly="readonly">

 

This would make the textfield readonly. The question is, is there some string [someString] such that <input type="text" name="someName" readonly="[someString]"> is NOT readonly? I tried false and empty string, but both of them still makes the textfield readonly

 

P.S.: I do know that not putting the readonly attribute will make the textfield NOT readonly

This is a case of standards making thing sappear more complex than they might otherwise need be:

 

The original htnml syntax was

<input type="text" name="someName" readonly>

nice simple and straightforward

 

but also invalid if you try to parse it as an XML document because an attribute in XML must have a value

 

so for XHTML compliance, a value must be provided for every attribute giving

<input type="text" name="someName" readonly="anyoldthing">

so now it is compliant

 

DTDs don't enforce ranges of values for an attribute (although xsd can do so), so there's nothing to validate what you actually define as the readonly value, just that there must be one.

 

I suspect that most browsers still take the more simplistic approach to this and ignore the value of the readonly attribute, caring only that it is set

 

 

You'll find a similar idiosyncracy for select boxes where

<option selected>

has to be

<option selected="selected">

for XHTML compliance

 

very percuiliar...

 

when using readonly you should always use readonly="readonly"...

 

of you don't want the textbox read only simply don't put readonly in.  This will let users input data into the field.

 

the other attribute that behaves in a similar fashion is disabled="disabled" which leaves the whol etextbox greyed out and uneditable...

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.