I am pulling dates from availability calender, this works great but i needed to calculate another field which is 1 year on from the selected date. this calculation only works if the field is of type 'Date'. Problem being i cannot set this field to 'non editable' by the user. other field types you can but not date. Why is this? And can anyone provide a solution?

thanks

Comments

quicksketch’s picture

Only textfield-based components have the ability to be "read-only", it's just not a feature of other widgets. This is largely because the HTML spec only supports an attribute called "readonly" on certain fields, so those are the ones that Webform provides a read-only option for.

thekevinday’s picture

The problem here is that webform is using "disabled" differently than what the HTML language defines it as.

By "Disabled", webform means "Read-only".
The HTML language (shortsightedly IMHO) decided to prevent readonly from being applied to select fields.

However, the usage of the HTML "Disabled" functionality does apply and likely has the desired effect that is being requested here.

This should be a feature request to:

  1. Correct the usage of the word "Disabled" to be "Read Only".
    - This is problematic because it would require a database upgrade and could confuse users who got used to the incorrectly used terminology.
  2. Add a "Disabled" option to all input fields.
    - I believe I heard somewhere that 'disabled' form fields do not get sent to the server and are not intended to be processed whereas readonly fields are (this statement needs confirmation).
    - If that is the case, then the usage of (the proper) 'disabled' would be improper here if the values of the field are expected.
    - But this is where the HTML language short-sightedness causes a problem.
    - see: http://www.w3.org/TR/html5/forms.html#the-readonly-attribute
    - from the above link:
    The difference between disabled and readonly is that read-only controls are still focusable, so the user can still select the text and interact with it, whereas disabled controls are entirely non-interactive. (For this reason, only text controls can be made read-only: it wouldn't make sense for checkboxes or buttons, for instances.)

    - It DOES make sense to have a read-only select list where the values are sent to the server, but should be disabled in that it is selectable only under certain conditions but the value should always be sent to the server.

We cannot do much about the standard, but perhaps having both a "Disabled" and a "Readonly" option that end users can choose at their own discretion would be a good feature to add (where applicable).

There also seems to be another issue on this: #1701514: Date Disabled.

Should this be switched to 7.x-4.x-dev instead of 7.x-4.0-alpha9?

quicksketch’s picture

- I believe I heard somewhere that 'disabled' form fields do not get sent to the server and are not intended to be processed whereas readonly fields are (this statement needs confirmation).

This is true, and the main reason why we use readonly instead of the disabled attribute. From a non-HTML perspective, I think the term "disabled" is fine for most users (who don't know the difference between readonly and disabled anyway).

Disabled in general causes a whole boatload of problems. The fact it doesn't get submitted in POST means the values don't get saved, which isn't expected. One way you can support it is by using a placeholder element that is disabled while a hidden element actually submits the value. But that approach (and most other hacks) far outweigh the ease of simply using readonly and calling it good.

danchadwick’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Also sprach quicksketch.