Skip to content
New issue

Have a question 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

changed email fields with the email type and added required parameter on... #1180

Merged
merged 2 commits into from
Apr 15, 2015

Conversation

tcitworld
Copy link
Member

... some stuff

Just tiny changes.

->add('name', 'text')
->add('email', 'text')
->add('name', 'text', array('required' => true))
->add('email', 'email')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe email can also be required now. cc @j0k3r @nicosomb

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The required isn't needed because, since the form is mapped to the User entity, it will apply annotation from the entity to the form. In that case, it will add these ones for the email:

 * @Assert\Email()
 * @Assert\NotBlank()

So, it will be required in some way 😃

And about the name, why should it be required?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The required isn't needed because, since the form is mapped to the User entity, it will apply annotation from the entity to the form.

It's just more pratical to use with mobile keyboards when entering your email (@ shows up). Nothing to do with server checking. Right ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And about the name, why should it be required?

My bad.

@j0k3r j0k3r added this to the 2.0 milestone Apr 15, 2015
@j0k3r
Copy link
Member

j0k3r commented Apr 15, 2015

As far as I can remember, I used text because the css doesn't handle properly the email type 😑 (yeah not a really good reason)

@@ -20,6 +20,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('email', 'email', array(
'required' => true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already declare constraints as new Constraints\NotBlank(), so this is not required to extra add the required attribute.

@j0k3r
Copy link
Member

j0k3r commented Apr 15, 2015

I was wondering if you got any problems while testing the v2 and then feel the need to add this requirement.
I'm just curious 😄

@tcitworld
Copy link
Member Author

I was wondering if you got any problems while testing the v2 and then feel the need to add this requirement.
I'm just curious 😄

I just like my browser starting to tell me the informations I entered aren't correct before sending the page. Of course it doesn't replace server-side checking which stays mandatory but I appreciate it.

j0k3r added a commit that referenced this pull request Apr 15, 2015
@j0k3r j0k3r merged commit 98510a4 into v2 Apr 15, 2015
@j0k3r j0k3r deleted the v2patch branch April 15, 2015 15:29
@nicosomb nicosomb modified the milestones: 2.0, 2.0.0-alpha Aug 12, 2015
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

Successfully merging this pull request may close these issues.

None yet

3 participants