8000 [Form] ReadOnly vs Disabled · Issue #2096 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Form] ReadOnly vs Disabled #2096

New issue

Have a question 8000 about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vicb opened this issue Jan 3, 2013 · 11 comments
Closed

[Form] ReadOnly vs Disabled #2096

vicb opened this issue Jan 3, 2013 · 11 comments

Comments

@vicb
Copy link
Contributor
vicb commented Jan 3, 2013

http://symfony.com/doc/current/reference/forms/types/text.html#read-only is wrong starting from 2.1

@Sgoettschkes
Copy link
Contributor

I'll improve this!

Reading https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig, from 2.1 on there are a read_only and a disabled option which both translate into their HTML counterpart. Is this correct?

@wouterj
Copy link
Member
wouterj commented Jan 3, 2013

@Sgoettschkes from the changelog:

[BC BREAK] read_only field attribute now renders as readonly="readonly", use disabled instead

@Sgoettschkes
Copy link
Contributor

That's what I meant. read_only now renders as readonly, disabled renders as disabled form attribute. Should I mention the BC Break in any special way?

@vicb
Copy link
Contributor Author
vicb commented Jan 4, 2013

No need to mention the bc break in the doc. Just send the pr against 2.1. Could you quickly search all the doc. For reference ? Thank you for handling the issue.

----- Reply message -----
De : "Sebastian" notifications@github.com
Pour : "symfony/symfony-docs" symfony-docs@noreply.github.com
Cc : "Victor Berchet" victor@suumit.com
Objet : [symfony-docs] [Form] ReadOnly vs Disabled (#2096)
Date : ven., janv. 4, 2013 00:32
That's what I meant. read_only now renders as readonly, disabled renders as disabled form attribute. Should I mention the BC Break in any special way?

Reply to this email directly or view it on GitHub.

@wouterj
Copy link
Member
wouterj commented Jan 4, 2013

I think you should add 2 .. versionadded:: 2.1 blocks in the document: One to say 'the disabled option is added in 2.1' and one to say 'the read_only option would be rendered as a readonly attribute, use disabled instead'.

You should add one of those versionadded block to reference/form/types/options/read_only.rst.inc and you should add the other to ref/form/types/options/disabled.rst.inc. After that you need to make sure that every type that extends FieldType should include the disabled option. These are: CheckboxType, ChoiceType, DateTimeType, DateType, FieldType, FileType, HiddenType, IntegerType, MoneyType, NumberType, PercentType, TextType and TimeType.

@Sgoettschkes
Copy link
Contributor

I added the versionadded to the options, but regarding the types I'm confused. Looking at DateType for example I see it extends AbstractType. I don't find a class extending the FieldType.

I also don't really understand where those Types get their options from. For example the DateType does not have any of the "normal" options described in the docs, so I'm not sure if it inherits the disabled/read_only?

I'll have a look if I can grasp the concept of the Form component and then add the missing parts to the docs.

@stof
Copy link
Member
stof commented Jan 4, 2013

@Sgoettschkes The form type inheritance is not PHP inheritance

@wouterj
Copy link
Member
wouterj commented Jan 4, 2013

@Sgoettschkes the parent of a form type is returned in the DataType::getParent() method.

We can see the options and their default values in the parent: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Extension/Core/Type/FormType.php#L194-218

@Sgoettschkes
Copy link
Contributor

I think I got it.

Could somebody have a look at https://github.com/Sgoettschkes/symfony-docs/commit/37c377078cd04c138bf32ca6f41d80438d14c05f? I'm not sure if I did it correct so I don't want to sent a premature PR!

@vicb
Copy link
Contributor Author
vicb commented Jan 8, 2013

@Sgoettschkes I think that the read_onlydescription is not crystal clear, otherwise it looks good. Do no hesitate to open a PR, that will be easier for discussing (you should think to change the target branch to 2.1 when you submit the PR)

@vicb
Copy link
Contributor Author
vicb commented Jan 8, 2013

Did you look for all occurences in the docs ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
0