Read-Only Fields Handled Incorrectly? / Not in DB

17 years 11 months ago #12110 by moneybagsxp
Came across an interesting observation... May want to check this before 1.0GC release!

When adding a field declared as "READ ONLY", in the back-end/client side it's not officially HTML Read Only, rather DISABLED?

See code excerpt from comprofiler.class.php:

[code:1]
function getFieldEntry( ... )

....


if($oReadOnly > 0) {
$pReadOnly=" disabled=\"disabled\" ";

....

[/code:1]


Uh... this should be "readonly", not disabled. :dry:

OK OK, so what's so bad about disabled vs. readonly?

In short, READONLY has the ability to be "successful", thus can be seen in GET/POST/REQUEST. Setting values to "READONLY" in CB RC2, or DISABLED, will never make it into the database!


more on Successful controls

17.13.2 Successful controls

A successful control is "valid" for submission. Every successful control has its control name paired with its current value as part of the submitted form data set. A successful control must be defined within a FORM element and must have a control name.


more on Read Only


www.w3.org/TR/html4/interact/forms.html#adef-readonly


readonly
When set for a form control, this boolean attribute prohibits changes to the control.

The readonly attribute specifies whether the control may be modified by the user.

When set, the readonly attribute has the following effects on an element:
  • Read-only elements receive focus but cannot be modified by the user.
  • Read-only elements are included in tabbing navigation.
  • Read-only elements may be successful.

The following elements support the readonly attribute: INPUT and TEXTAREA.


BEAT... please put me in my place or help me to understand.

I was so confused when my data started dropping out (err..not getting imported, all to find it wasn't in REQUEST scope)

Post edited by: moneybagsxp, at: 2006/05/10 01:28

www.pixelchutes.com - Where every pixel matters.

Please Log in to join the conversation.

17 years 11 months ago #12114 by beat
You have a good question here. And I love last-minute questions. They keep us awake and moving :)

In the end, it's the server side which is more important: read-only fields are ignored there, to avoid tampering.

There are several reasons we did use disabled insted of readonly:

- all field types can have this instead of only two (not text-specific)

- no focus on tabs: better, as they can't be edited anyway

- old browser compatibility (readonly is more recent the disabled i believe).

After re-reading the new docs, I don't see any good reason to go to readonly client-side.

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

17 years 11 months ago #12115 by moneybagsxp
Replied by moneybagsxp on topic Re:Read-Only Fields Handled Incorrectly? / Not in
Thanks, Beat!

This all makes sense. To a developer, seeing Read Only but having do another was confusing. I understand the message being conveyed to the end-users.

Only another reason to include the HIDDEN form type :)

PS
Hey, someone dropped my Karma? ... I'm sure it's for posting this within hours of the extended, extended, extended stable release! :)

Oh well, guess that's why they call it Karma? What goes around comes around...LoL :side:

www.pixelchutes.com - Where every pixel matters.

Please Log in to join the conversation.

17 years 11 months ago #12121 by MadPax
There you go Man!

With a question like that you deserve at least two thumbs up.:side:

But let me keep one to press the space bar.;) :laugh:

Please Log in to join the conversation.

17 years 11 months ago #12125 by moneybagsxp
Replied by moneybagsxp on topic Re:Read-Only Fields Handled Incorrectly? / Not in
MadPax wrote:

There you go Man!

With a question like that you deserve at least two thumbs up.:side:

But let me keep one to press the space bar.;) :laugh:


Woo hoo! Welcome to Karma Level 1 :silly:

www.pixelchutes.com - Where every pixel matters.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.210 seconds

Facebook Twitter LinkedIn