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

Fieldset validating issue #140

Closed
jraack opened this issue Apr 5, 2017 · 10 comments
Closed

Fieldset validating issue #140

jraack opened this issue Apr 5, 2017 · 10 comments

Comments

@jraack
Copy link

jraack commented Apr 5, 2017

Hi Guys,

I just found an issue with the fieldset. I have a form based on the fields syntax.
When i add fields under a fieldset it is not validating my input fields if they are required?

form:  
  fields:    
    -
        name: email
        outerclasses: medium-12 columns
        placeholder: E-mail adres
        type: email
        validate:
          required: true
          message: PLUGIN_LOGIN.EMAIL_VALIDATION_MESSAGE
    -
        type: fieldset
        outerclasses: row
        fields:            
        -
            name: newsletter
            outerclasses: medium-12 columns
            type: checkbox

Or do i missing something?
Issue ref Fieldset support

Best,
Joe

@bobbwal
Copy link

bobbwal commented Apr 5, 2017

Hi, what's your frontmatter look like?

@jraack
Copy link
Author

jraack commented Apr 5, 2017

@bobbwal see example.

---
form:  
  fields:    
    -
        name: email
        outerclasses: medium-12 columns
        placeholder: E-mail address
        type: email
        validate:
          required: true
          message: PLUGIN_LOGIN.EMAIL_VALIDATION_MESSAGE
 -
        type: fieldset
        outerclasses: row
        fields:  
            -
                name: initials
                outerclasses: medium-4 columns
                placeholder: initials
                type: text
                validate:
                    required: true
            -
                name: suffix
                outerclasses: medium-4 columns
                placeholder: suffix
                type: text
                validate:
                  required: false
            -
                name: lastname
                outerclasses: medium-4 columns
                placeholder: lastname
                type: text
                validate:
                    required: true 
    -
        type: fieldset
        outerclasses: row
        fields:            
        -
            name: newsletter
            outerclasses: medium-12 columns
            type: checkbox
            label:
        -
            name: newsletter
            outerclasses: medium-12 columns
            type: checkbox
            label: 
        -
            name: big
            type: radio
            label: 
            outerclasses: medium-12 columns
            default: markdown        
            validate:
                required: false
            options:
                true: Yes
                false: No             
  buttons:
      -
          type: submit
          value: Register

  process:
      register_form: true
      display: '/registration'
      message: "Thank you"
---

@bobbwal
Copy link

bobbwal commented Apr 5, 2017

Hmm, looks in order to me. Does the fieldset need a name? Also, there aren't any required fields within the fieldset here?

@jraack
Copy link
Author

jraack commented Apr 5, 2017

@bobbwal thanks for your reply; i have updated the frontmatter.

@bobbwal
Copy link

bobbwal commented Apr 5, 2017

All I can suggest is try adding a name for the fieldsets. Sorry I can't be more help.

name: first-set
type: fieldset
fields:

@jraack
Copy link
Author

jraack commented Apr 5, 2017

hi @bobbwal
not a problem, i will try, thanks

@flaviocopes
Copy link
Contributor

It's working fine for me too. The browser frontend validation is kicking in (Chrome)

@rhukster
Copy link
Member

Not related, but i've fixed an issue with data.html.twig and data.txt.twig not being able to find fields inside fieldset. This will be sorted in next release. Validation works for me btw.

@jraack
Copy link
Author

jraack commented Apr 26, 2017

@rhukster i have updated the data.html and data.txt and the validation is working now on my side 👍
Only thing that is not working, nested fields inside fieldsets are being cleared if the forms returns an error.
If i put a field outside the fieldset, it shows my previous data.

@rhukster
Copy link
Member

Ok this last issue is fixed in develop

rhukster added a commit that referenced this issue May 12, 2017
* refactor form-processing to take non-pre-processed forms into account

* cleanup

* Reference #149 in changelog

* Fix on-page forms

* Fix fieldset forms not being reopulated #140
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants