Arrow Home arrow Forums
larger font smaller font default font Fixed screen resolution Auto adjust screen size

Joomlapolis Forums  


Read-Only Fields Handled Incorrectly? / Not in DB
Date: 2006/05/10 07:24 By: moneybagsxp Status: User  
Karma: 9  
Senior Joomlapolitan

Posts: 70
graphgraph
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:

  function getFieldEntry( ... ) .... if($oReadOnly 0) {    $pReadOnly=" disabled=\"disabled\" "; ....




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

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


http://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.
Click here to see the profile of this user The topic has been locked.

Re:Read-Only Fields Handled Incorrectly? / Not in DB
Date: 2006/05/10 08:11 By: beat Status: Admin  
Karma: 256  
Admin

Posts: 4214
graphgraph
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 - Developer on Community Builder core Team
- If you like CB and this forum, you will love Nick's CB 1.2 RC4 reference manual ! : Click here to Get it now
- Would like to help us move faster ? Get it, and/or help us spend more time coding by helping others in this forum, many thanks
Click here to see the profile of this user The topic has been locked.

Re:Read-Only Fields Handled Incorrectly? / Not in
Date: 2006/05/10 08:31 By: moneybagsxp Status: User  
Karma: 9  
Senior Joomlapolitan

Posts: 70
graphgraph
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
www.pixelchutes.com - Where every pixel matters.
Click here to see the profile of this user The topic has been locked.

Re:Read-Only Fields Handled Incorrectly? / Not in
Date: 2006/05/10 10:35 By: MadPax Status: User  
Karma: 3  
Junior Joomlapolitan

Posts: 33
graphgraph
There you go Man!

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

But let me keep one to press the space bar.
Click here to see the profile of this user The topic has been locked.

Re:Read-Only Fields Handled Incorrectly? / Not in
Date: 2006/05/10 11:40 By: moneybagsxp Status: User  
Karma: 9  
Senior Joomlapolitan

Posts: 70
graphgraph
MadPax wrote:
There you go Man!

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

But let me keep one to press the space bar.


Woo hoo! Welcome to Karma Level 1
www.pixelchutes.com - Where every pixel matters.
Click here to see the profile of this user The topic has been locked.

Documentation

Documentation Subscription Service
(updated for CB 1.2 RC4)

What?

Why?

Where?

Just click here for answers!

Click here for a yearly subscription: subscribe now

Download Latest Release

The latest stable Community Builder Release is version 1.1 for Joomla 1.0 and Mambo.
You need to be a registered member of Joomlapolis to download.

The latest release candidate of Community Builder is version 1.2 RC4, native for Joomla 1.0, 1.5 and Mambo.
It is available as "thank you" to all CB documentation subscribers and now also to all registered joomlapolitans.

CB Login