I wonder if while returning an array of files via ajax, to a form that that only expects a single file, (no array of file validators), if it will validate?
Perhaps making a form that has multiple widgets but only one validator of the same name might be a good test, (Providing Symfony doesn't check for mismatched validators for widgets)? On Nov 16, 10:45 am, "Jesse B. Hannah" <je...@jbhannah.net> wrote: > One way to do this is with embedded forms. A good example is available > athttp://trac.symfony-project.org/ticket/4906#comment:13, but here's > a quick rundown of it: > > $form = new sfForm(); > for ($i = 1; $i <= 5; $i++) { > $form->widgetSchema[$i] = new sfWidgetFormInputFile(); > $form->widgetSchema->setLabel($i, 'File ' . $i);} > > $this->embedForm('upload', $form); > $this->widgetSchema->setLabel('upload', 'Upload files'); > > How this will look in the view (you can use the debug inspector in > 1.3) is there'll be a field $form['upload'], and then each file widget > will be $form['upload'][1] through $form['upload'][5]. You can also > start with just one input widget and then use jQuery to add more input > widgets to the embedded form (I can't give an example right now > because I'm still figuring out how to do this). > > A couple more pages with some good discussion on embedded forms: > > http://blog.barros.ws/2009/01/01/using-embedformforeach-in-symfony-pa... > (focuses on multiple embedded forms using embedFormForEach, but still > a good overview of the > concept)http://www.symfony-project.org/blog/2008/11/12/call-the-expert-custom... > > --jbh > > Jesse B. Hannah > > On Nov 14, 1:02 pm, Sid Bachtiar <sid.bacht...@gmail.com> wrote: > > > Hi, > > > How to declare an array of input field in sfForm? Is this where > > embedded form come in? > > > In this case I want to use jquery MultiUpload library but it works by > > creating upload fields with the same field name, so when the form is > > uploaded, it will be as array. > > > Cheers, > > > Sid > > -- > > Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz > > -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.