On Nov 20, 2007 4:22 PM, Carl Franks <[EMAIL PROTECTED]> wrote: > > On 20/11/2007, Jonas Alves <[EMAIL PROTECTED]> wrote: > > Hi there, > > I need to set a nested_name in a radiogroup element. It's possible to do > > that? > > If I do somethig like this: > > - type: Radiogroup > > nested_name: user > > name: gender > > options: > > - [ 'm', 'Male' ] > > - [ 'f', 'Female' ] > > > > I get this error message: "cannot set nested_name at > > /Library/Perl/5.8.6/HTML/FormFu/ObjectUtil.pm line 266" > > > > Probably I need to patch Radiogroup to pass the nested_name parameter > > to the Fieldset. > > I'll need to have a think about this. > At the moment, only Blocks can have nested_name() set, for Fields, > it's a readonly method which calculates the name based on the > nested_name of any parent blocks. > > I think I've used these assumptions in some of my code for the new > HTML-FormFu-Model-DBIC, so I'll need to take a look at that, to see > what the consequences of allowing Radiogroup to override nested_name() > would be.
Yes, that's what I were preparing to do. > You also can't really pass anything to the Radiogroup's fieldset, as > it's not actually a fieldset object, the fieldset only exists in the > radiogroup template file. Yep, I know that now. :/ > A temporary work-around would have to be: > > --- > elements: > - type: Block > tag: ~ > nested_name: user > elements: > - type: Radiogroup > name: gender > options: [ [m, Male], [f, Female] ] I will try that. > Also, is it necessary to use nested_name here? No, but I need to use a dot in the parameter name to pass it as a relationship to DBIC and that's not allowed in the current version in trunk. > I've just realised that I've discussed this with Brian C off-list, but > haven't discussed this on the list yet... > The nested_name feature won't be pushed out to cpan until the > FormFu-Model-DBIC work is done, because I don't want anybody using > nested_name just "because it's there". Seems reasonable, but I'm using it to make things easy. That way I don't have to lead with parameters mugging to get the data the way I need. > The reason for this is that FormFu-Model-DBIC will require you to > follow conventions matching field names to column names, and block's > nested_name to relationship names. > This provides the ability to fill a forms' default values from a > single row, following any depth of relationships, with a single method > call. > Likewise, you can update a dbic row, and any depth of relationships > from a submitted form, using only one method call. Yes, that's what I'm already doing. > I expect this functionality to be later extended to allow configuring, > so that you don't have to follow these conventions, What kind of configuration are you planing here? > but that's for a > later date (and probably for someone else interested in it, to code). > > Carl Thanks a lot Carl, -- Jonas _______________________________________________ HTML-FormFu mailing list [email protected] http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
