Development

#3232 (Filln Form cannot be used with out validating a form using a yaml validator)

You must first sign up to be able to contribute.

Ticket #3232 (closed defect: fixed)

Opened 8 months ago

Last modified 7 months ago

Filln Form cannot be used with out validating a form using a yaml validator

Reported by: Stephen.Ostrow Assigned to: fabien
Priority: minor Milestone: 1.0.14
Component: validation Version: 1.0.12
Keywords: fillin form Cc: fabien
Qualification: Ready for core team

Description

I am currently doing most of my validation of forms using

public function validateFormFunction()
{
  //Do validation
  return false;
}

However, I was normally still validating atleast one field in the "formFunction.yml" file. I just came across an instance where I was not doing any validation in the validation.yml file but I still needed the fillin functionality.

When I put just this in my validation.yml file I got an error for not having a methods category

fillin:
  enabled: true  # Enable the form repopulation
  param:
    name: register_form_two  # Form name, not needed if there is only one form in the page
    skip_fields:   [email]  # Do not repopulate these fields
    exclude_types: [hidden, password] # Do not repopulate these field types
    check_types:   [text, checkbox, radio, password, hidden] # Do repopulate these

I think you should be able to use the fillin feature without validating the form through the yaml file.

Attachments

sfValidatorConfigHandler.class.patch (1.5 kB) - added by FabianLange on 05/02/08 21:05:40.
enables the fillin feature of validation yml files to work without any validators

Change History

05/02/08 10:51:00 changed by FabianLange

  • owner changed from fabien to FabianLange.
  • status changed from new to assigned.
  • qualification changed from Unreviewed to Design decision.

confirmed. sfValidatorConfigHandler does add the fillin info only if there are validators specified.

workaround would be to specify a dummy validator. I look into this

05/02/08 11:46:00 changed by FabianLange

  • cc set to fabien.
  • status changed from assigned to closed.
  • resolution set to wontfix.

Hi Stephen, i had a look into it and must say that you could consider this as a bug. I think its not clear. I would implement it as bugfix anyway, but unfortunately this would require quite a lot of changes in how validation configuration is handled. Even that wouldnt be so bad, but even worse (:-)) this feature is deprecated in sf 1.1.

I would hereby propose you a workaround to simply implement a dummy validation.

fields:
  name:
    sfStringValidator:
      min:       0

I guess normally people will not come to your point, because if you want to do validation yourself you most likely combine it with some basic symfony validation. In most cases a required validation.

Hope you accept this solution

05/02/08 19:40:10 changed by fabien

I think we must be able to just configure the fillin value without being forced to add a dummy field. If we can easily fix the validation config handler, I'm +1 to fix the issue.

05/02/08 19:58:49 changed by FabianLange

Hi fabien, we could fix it, but that would remove a lot of error handlinc code that tells the user what to put into the yml file. I can work on a potential patch and then you can decide

05/02/08 20:02:59 changed by FabianLange

  • status changed from closed to reopened.
  • resolution deleted.

05/02/08 20:43:15 changed by Stephen.Ostrow

Thank you for looking into this. I think I ended up going the way of a dummy validator on the project. I would agree that it should probably be fixed.

05/02/08 21:05:04 changed by FabianLange

  • owner changed from FabianLange to fabien.
  • status changed from reopened to new.
  • qualification changed from Design decision to Ready for core team.

actually its not that much of a change. if fillin is present there will be no exception about missing sections. also adding fillin will ignore if any validators have been registered. feel free to check and commit or just tell me then i will commit this (1.0 & 1.1 ?)

05/02/08 21:05:40 changed by FabianLange

  • attachment sfValidatorConfigHandler.class.patch added.

enables the fillin feature of validation yml files to work without any validators

05/03/08 17:36:13 changed by fabien

ok for both 1.0 and 1.1.

Thanks

05/03/08 20:35:11 changed by FabianLange

  • status changed from new to closed.
  • resolution set to fixed.

(in r8754) validation yml with fillin is used even without other validators defined in the file. fixed #3232

05/03/08 20:38:17 changed by FabianLange

  • milestone set to 1.0.14.