|
|
Read-Only Fields Handled Incorrectly? / Not in DB
|
|
Date: 2006/05/10 07:24
|
By: moneybagsxp
|
Status: User
|
|
|
Karma: 9  
|
|
Senior Joomlapolitan  | Posts: 70 |   | |
|
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.
|
|
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 |   | |
|
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
|
|
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 |   | |
|
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.
|
|
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 |   | |
|
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.
|
|
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 |   | |
|
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.
|
|
The topic has been locked. |
|
|