Mark Hedges | 1 Nov 17:50
Favicon

Re: [FormBuilder] support for Source::File


On Tue, 31 Oct 2006, Nate Wiger wrote:
> > 
> > Bareword found where operator expected at (eval 186) line 1, near "$value
> > confirm_pass"
> 
> It's quite possible the Source::File module can't handle more complex
> cases, due to the fact that it always splits on , and evals stuff
> inline.
> 
> What should probably happen is only those fields that are known to
> accept arrayrefs get split, which should solve most problems.

Sucks if you have a field named 'options' though.

Or if you pass an arrayref to your validate to validate a list 
of valid options.

validate:
    myfieldname:  beef, chicken, horta, fish

How could it know?  

Maybe it gets too far away from the original syntax.  It could 
be:

validate:
    myfieldname:  [ beef, chicken, horta, fish ]

Or, it could be even more like YAML:
(Continue reading)

Mark Hedges | 1 Nov 21:53
Favicon

[FormBuilder] CGI::FormBuilder::Source::YAMLSyck


Since there's such a nice plugin structure, I've written 
CGI::FormBuilder::Source::YAMLSyck, which reads in a YAML file 
with YAML::Syck.  You just explicitly set 'fieldopts' and define 
the full structure as returned by parse -- it doesn't do 
anything to it except put in the defaults from construction. 
It's pure YAML syntax, although I don't know how subrefs will 
work if you don't define the whole thing as a CODE ref.  

I'll work out the bugs and put it on CPAN this week or next.

Mark
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers

Nate Wiger | 1 Nov 23:26
Picon
Gravatar

Re: [FormBuilder] CGI::FormBuilder::Source::YAMLSyck

Probably just "::YAML" would be best, but other than that sounds
great. (I doubt we'll have two competing YAML source parsers, and I've
always thought Syck was a bit silly)

-Nate

On 11/1/06, Mark Hedges <hedges <at> ucsd.edu> wrote:
>
> Since there's such a nice plugin structure, I've written
> CGI::FormBuilder::Source::YAMLSyck, which reads in a YAML file
> with YAML::Syck.  You just explicitly set 'fieldopts' and define
> the full structure as returned by parse -- it doesn't do
> anything to it except put in the defaults from construction.
> It's pure YAML syntax, although I don't know how subrefs will
> work if you don't define the whole thing as a CODE ref.
>
> I'll work out the bugs and put it on CPAN this week or next.
>
> Mark
> _______________________________________________
> FBusers mailing list
> FBusers <at> formbuilder.org
> http://www.formbuilder.org/mailman/listinfo/fbusers
>
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers

(Continue reading)

Mark Hedges | 2 Nov 23:34
Favicon

[FormBuilder] CGI::FormBuilder::Source::YAML


Assuming the namespace registration is approved, this should 
appear on CPAN at some point soon.

I got the references to work, too, thus the caveat "(almost) 
pure YAML syntax".

Or you could write subs in YAML syntax directly in the file.

The Catalyst plugin needs further mods to support a source type 
other than 'File.'  I'll continue testing that a bit.

Mark
Attachment (CGI-FormBuilder-Source-YAML-1.0.1.tar.gz): application/octet-stream, 5516 bytes
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers
Mark Hedges | 2 Nov 23:57
Favicon

Re: [FormBuilder] CGI::FormBuilder::Source::YAML


Oooh, neat, this has the added benefit that if you have a 
perl validation function generator, you can pass params from the 
YAML file.

validate:
    myfield:    
        javascript: /^[\s\S]+$/
        perl:       !!perl/code: >-
            {   return fb_perl_validate({
                    min         => 2,
                    max         => 50,
                    profanity   => 'check',
                });
            }

fb_perl_validate returns a subref that checks the appropriate things.
(I hate rewriting subrefs for every little variation.)

Mark

On Thu, 2 Nov 2006, Mark Hedges wrote:

> From: Mark Hedges <hedges <at> ucsd.edu>
> To: fbusers <at> formbuilder.org
> Date: Thu, 2 Nov 2006 14:34:08 -0800 (PST)
> Subject: [FormBuilder] CGI::FormBuilder::Source::YAML
> 
> 
> Assuming the namespace registration is approved, this should 
(Continue reading)

frank_coleman | 3 Nov 04:35

[FormBuilder] can't render form in TT2


Hi!
I am trying to use FB with TT2.
Rendering the form by putting [% form.render %] in the template works, but the following doesn't work

---- CODE ----

     [% form.start %]
      <table>
        [% FOREACH field = form.fields %]
        <tr valign="top">
          <td>
            [% field.required
                  ? "<b>$field.label</b>"
                  : field.label
            %]
          </td>
          <td>
            [% IF field.invalid %]
            Missing or invalid entry, please try again.
        <br/>
        [% END %]

        [% field.field %]
      </td>
    </tr>
        [% END %]
        <tr>
          <td colspan="2" align="center">
            [% form.submit %] [% form.reset %]
(Continue reading)

Mark Hedges | 3 Nov 19:20
Favicon

Re: [FormBuilder] can't render form in TT2


On Thu, 2 Nov 2006, frank_coleman wrote:
> 
> Hi! I am trying to use FB with TT2. Rendering the form by 
> putting [% form.render %] in the template works, but the 
> following doesn't work

It sounds like you're directly assigning the constructed but 
unprepared form to a variable in your existing TT2 template.

If you want to use FB's TT2 feature, you have to use the 
'template' parameter to FB->new().  See the manual page.

If you already have a TT2 template rendering system in place and 
you're trying to drop in FB, you could use FB's template param 
and have a separate TT2 file just for the rendering of the form.  
In your normal (enclosing) template you say [% form.render %] 
and in your FB (interior) template you do the precise rendering 
according to the manual.

Or, I think you can assign your form variable to your template 
as $form->prepare() instead of just $form.

If that doesn't help, can you share your code?

Mark

_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
(Continue reading)

frank_coleman | 6 Nov 04:24

Re: [FormBuilder] can't render form in TT2


Hello Mark!
I am using Catalyst::Plugin::FormBuilder,
which automatically assigns the form to a TT2 variable.

The strange thing is that the labels are displayed but not the fields themselves.

[% field.label %] produces output
[% field.field %] does not

Here's the code.

FB YAML fil
------------
name: foo
method: post

fields:
     one:
          type: text
          required: 1
     two:
          type: text
          required: 0

Catalyst action
---------------

sub form : Local Form {
     my ($self, $c) = @_;
(Continue reading)

Steve Schwarz | 6 Nov 04:50
Picon

[FormBuilder] cleanopts and static fields

Hi All,
I made a small change to static.pm so it would honor the cleanopts setting used by radio and other option types when rendered via confirm() or by changing the type to static

At line 80 I changed:
#        $tmp .= escapehtml($value);
to:
    $tmp .= ($self->cleanopts ? escapehtml($value) : $value);

Best Regards,
Steve

_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers

Gmane