[html-formfu] Subforms show up as text fields
Leanan Sidhe
the.leanan.sidhe at gmail.com
Thu Mar 5 17:52:01 GMT 2009
Hrm. I'm beginning to wonder if my stuff shouldn't work the way I have it.
My problem was that my form is spread across a bunch of tabs. I'm using
jquery's tab plugin for a lot of it, and am loading a bunch of TT templates
to build it up. My problem was I didn't want to do all the bulding of the
various divs and such I needed for the tabs, so I have something like:
#some base TT file
<form method=3D"post" action=3D"" >
<div id=3D"tab_one">
[% PROCESS 'MyAction/tab_one.tt2' %]
</div>
..... More divs for more tabs
</form>
And then in my tab_one.tt2, I have:
[% FOREACH field =3D form.get_fields %]
[% NEXT IF field.parent.nested_name !=3D 'tab_one' %]
[% field.render %]
[% END %]
Except for my current issue with repeatables, it all seems to be working as
I would expect it to. I tried replacing my main template with just [% form
%] instead of all the sub templates that go through the fields / elements
and render them individually if they are in the proper nested, and it all
works as it has been.
I notice that your sub configs don't have the '---' line... out of
curiosity, what happens if you just add that line to the very beginning
(leave all else as it is)?
On Thu, Mar 5, 2009 at 12:33 PM, Ascii King <tech at swattermatter.com> wrote:
> I tried using Leanan's code almost exactly. The only change I made was to
> remove the quotes around the filenames. I still get the following error:
>
> |"Can't locate object method "elements" via package
> "HTML::FormFu::Element::Text"
>
> I'm sure this is referring to the 'elements:' line in the subconfig.
> ---
> elements:
> - type: Submit
> name: submitted
> value: Submit
> |
>
> |If I remove those lines, it displays the button, but as a text field.| If
> I put in a fieldset it then gives me a similair error.
>
> - type: Fieldset
> legend: Test Fieldset
> element:
>
> - type: Text
> name: Test1
> label: Test 1
>
> The error it gives is :
>
> |"Can't locate object method "legend" via package
> "HTML::FormFu::Element::Text"|
>
> If I use a config file with two text elements or more, it displays only t=
he
> last text box. This is my entire subconfig file.
>
> - type: Text
> name: Test1
> label: Test 1
>
> - type: Text
> name: Test2
> label: Test 2
>
> This is the output:
>
> <div class=3D"text label">
> <label>Test 2</label>
> <input name=3D"Test2" type=3D"text" />
> </div>
>
>
>
> Leanan Sidhe wrote:
>
>> I use subconfigs, and it works fine. Here is how mine is set up:
>>
>> My base config:
>>
>> ---
>> elements:
>> #stuff like action,indicator, etc
>> load_config_file:
>> - 'MyAction\config_a.yml'
>> - 'MyAction\config_b.yml'
>> # repeat as necessary for all sub configs.
>>
>> A sub config:
>>
>> ---
>> elements:
>> - type: Block
>> nested_name: foo
>> elements:
>> #text boxes, selects, etc.
>>
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090305/fa=
27b5ac/attachment.htm
More information about the HTML-FormFu
mailing list