Re: [Catalyst] configurable base url?

2007-12-06 Thread Andreas Marienborg


On 6. des.. 2007, at 18.32, Pablo Collins wrote:


Hi all,

I some catalyst apps whose different versions I'd like to make  
available by base path, like


http://mydomain/myspecialapp/version1.2/
http://mydomain/myspecialapp/version1.3/
etc.

I was planning on using a lighttpd or apache proxy to several  
Catalyst::Engine::HTTP processes running the different versions.  
That part is straightforward.


What I'm hung up on is how to tell catalyst to throw away the / 
myspecialapp/version1.3 part of the url and start the controller  
matching from there. I'd like to not have to change the names and  
namespaces of the controllers based on their versions if possible.


Instead I'd like to be able to put the application root url in the  
config and have it just work.


Is this possible / relatively easy to do?

Thanks much.

-Pablo



Uhm, if you configure your webserver to send /version12/ to one  
instance of HTTP (I would use fastcgi), and then in your application  
use uri_for to generate urls, the root should be set and appended  
automaticly. I rely on this all the time when developing, and it works  
quite nicely, untill someone forgets to use uri_for in one place :)



- andreas

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] help with Catalyst::Plugin::Form::Processor

2007-12-06 Thread Bill Moseley
On Thu, Dec 06, 2007 at 02:45:51PM -0800, Michael Higgins wrote:
> 
> So, to revisit this overall...
> 
> It looks like, short of writing a hook to DBIC, I have to somehow get
> data into my forms... in particular, a select list. 
> 
> I think the list comes from a method ->options, from the form field
> select object ( but I don't know). Could it be possible to override such
> a thing to accept, say, an array of arrays?

In the form you can define a field as a select:

favorite_fruit  => Select,

Now, if you had a model class it would see that is a "Select" and then
look for a 1-to-many relationship and fetch the items from the
database and place them in the field's option list.

You can manually set the options in your form class by creating a
method like this when not using a "model" to automatically populate
the list, or when you just want to manually create the options:

sub favorite_fruit_options {
my $form = shift;

return (
1 => 'Apple',
2 => 'Grape',
3 => 'Cherry',
);
}


And then later you get that list back:

$options = $form->field('favorite_fruit')->options;

> $Form::Processor::Field::Select::init_options = sub {
> return [ {label=>'this',value=>'that'}, {label=>'some',value=>'other'}];
> };

I suppose that would work.  You would likely do that in a sub-class
for a custom field.

package Form::Processor::Field::Fruit;
use strict;
use warnings;
use base 'Form::Processor::Field::Select';

sub init_options {
return [
{label=>'this',value=>'that'},
{label=>'some',value=>'other'}
];
}
1;

Or I think so, anyway.



> How can I get my 'select' to look like a drop down box?

Well, a drop down box is a presentation issue.  I'm not sure if this
is in that example "form_widgets.tt" file, but I have had it where

field( "What's your favorite fruit?", 'favorite_fruit' );

Will display either a drop-down select list or a set of radio buttons
depending on how many options there are.  But, Form::Processor doesn't
determine that.

Well, a field has a "widget" attribute that will give a hint to what
kind of, eh, widget to generate.  So you could define the fields:

favorite_fruit  => 'Fruit',  # use the Fruit field from above

dislike_fruit => {
type=> 'Fruit',
widget  => 'radio',
},

And that would give a *hint* to the presentation layer to show the
second field as a radio instead of a drop-down.


>  return {
> required => {
> sh_name => {type  => 'Select', size => 20},

By the way, if "sh_name" is something specific to your application and
might be used in multiple forms than you might make a custom field
(like Fruit above) so you can use it in multiple forms and just say:

 required => {
 sh_name => SH_Name,

Then that field can the size set and any custom validation.

-- 
Bill Moseley
[EMAIL PROTECTED]


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] help with Catalyst::Plugin::Form::Processor

2007-12-06 Thread Michael Higgins
On Thu, 6 Dec 2007 14:45:51 -0800
Michael Higgins <[EMAIL PROTECTED]> wrote:

> 
> So, to revisit this overall...
> 
> It looks like, short of writing a hook to DBIC, I have to somehow get
> data into my forms... in particular, a select list. 

[8<]

> How can I get my 'select' to look like a drop down box?
> 
>  return {
> required => {
> sh_name => {type  => 'Select', size => 20},
> 
> Doesn't seem to do it? Shouldn't that make a drop down box?
> 

Ah, now I know  this doesn't create html and it doesn't make a
form with options select without a result object, right? 

And in any case, it won't return something I can unpack in my
template like [% form %]

I guess it's time to sleep and find another way to do these when I can
think.

Thanks again, sorry for the static.

Cheers.


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] help with Catalyst::Plugin::Form::Processor

2007-12-06 Thread Michael Higgins

So, to revisit this overall...

It looks like, short of writing a hook to DBIC, I have to somehow get
data into my forms... in particular, a select list. 

I think the list comes from a method ->options, from the form field
select object ( but I don't know). Could it be possible to override such
a thing to accept, say, an array of arrays?

$Form::Processor::Field::Select::init_options = sub {
return [ {label=>'this',value=>'that'}, {label=>'some',value=>'other'}];
};

??
 
Is there any quick hack like to get this making forms?

How can I get my 'select' to look like a drop down box?

 return {
required => {
sh_name => {type  => 'Select', size => 20},

Doesn't seem to do it? Shouldn't that make a drop down box?

Any help appreciated, of course.

Cheers,

-- 
 |\  /||   |  ~ ~  
 | \/ ||---|  `|` ?
 ||ichael  |   |iggins\^ /
 michael.higgins[at]evolone[dot]org
 

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] help with Catalyst::Plugin::Form::Processor

2007-12-06 Thread Bill Moseley
On Thu, Dec 06, 2007 at 10:22:09AM -0800, Michael Higgins wrote:
> On Thu, 6 Dec 2007 10:16:05 -0800
> Michael Higgins <[EMAIL PROTECTED]> wrote:
> > Thanks a lot for your replies. Yes I did set up and use the example
> > application. The problem is, I can't make any sense out of the
> > templates, which seem to do all the work. :(
> > 
> > I can make simple templates, no process, block or wrapper. So, I'm
> > trying to iterate, somehow, in some rational order, even sorted would
> > be fine, to expose all the fields in my form.
> > 
> > No wrapper, no Template magic, just the fields I've set up in the same
> > order each time. With labels, or any other key information, would be
> > nice...
> > 
> > So, what is the simplest example of returning the form object fields
> > in a form in TT?

It's a framework and no scaffolding. ;)

I'm sure you know this, but forms are objects that are a collection of
fields.

Fields are a given type that know how to validate their input,
localize error messages, and move the valid input into an internal
representation (e.g. a date string into a DateTime object).  Fields
also know how to go the other direction -- from a DateTime object to
one or a collection of fields.  (Although, I think RHTMLO handles that
much better.)

The form knows how to validate each field and preform other logic
related to the given form (is a full address entered if the billing
address is checked?).

If the form inherits from a "model" class then the form also knows how
to populate possible options for a given field (select lists, radio
groups), and how to move the data between the form and the database.

Basically, it just a way to map and validate the data path between an
internal representation and an external one in single units called
forms.  The markup is, well, just an encoding layer.  The same form
would be used for non-html, like JSON, XMLRPC, cron jobs, etc.


> Manually set up the form:
> 
>  
> Data
> 
> 
> Manually set up the order of fields:
> 
> [% SET fieldlist = ['sh_name','cn_name'] %]

You could also do this if you don't care about order:

FOR field in form.fields;

> That reference my labels:
> 
> [% FOREACH labk IN fieldlist %]
> 
> I can expose the form field, finally:
> 
> [% SET f = form.field(labk) %]
> 
> [% labels.$labk %]
> 

And a field can have labels, too.



> What can I do with C::P::Form::Processor (aside from trying to hook
> this to my DBIC classes) to make this more... 'elegant'? ;-)

Well, I'm not sure what is your type of elegance, but what I like is:

1) I generate a form class that contains everything need to define and
validate a form.

2) Once the form is defined adding this to a very thin controller to
create and update, say, a user:

sub edit : Local {
my ( $self, $c, $user_id ) = @_;

return unless $c->update_from_form( $user_id );

$c->post_redirect( 'view', 'User Updated' );
}

3) Creating a simple template that doesn't contain much markup but
gives the template author the freedom to customize the form but still
be consistent with all the other forms in the application.

The "form_wrapper" takes care of the  and action (we know the
action from $c->action) and displaying a list of any fields that might
have failed validation.

The "field()" macro displays a field's markup, including any error
messages, and possibly tips.  I put my fields in a  so the entire
field, label, javascript errors, etc. can be highlighted.

Sorry, that does mean you have to spend time once coding up a template
to handle the wrapper and field() macro, but I like it because I don't
want to type that stuff over and over again in the individual
templates.  And if I hard code a field as a text field and then later
want it to be a drop down or radio select I don't have to change
anything except the form.

[%
# Form to edit a user

page.title = form.item
? 'Create a new user'
: 'Update user: ' _ form.item.full_name;


WRAPPER form_wrapper;
PROCESS user_data;
END;
%]

[% BLOCK user_data %]

User Data

[%
field('First name', 'first_name' );
field('Last name', 'last_name' );

field('Your US zip code', 'zip', 'Make one up!' );
field('Your email', 'email' );
field('Username', 'username' );

'
Select from our approved list of passwords.
';

field( 'Password', 'password', 'Change your password' );
field( 'Retype password', 'password_chk' );

field('Your age', 'age',
'This is only for targeted advertising' );

field('Check to publish your personal info on the Internet', 
'share' );

%]

[% END %]

Of course, "user_data" can be in a separate file and used by multiple
fields that require user data.

Not sure if that qualifies for elegant or not.



-- 
Bill Moseley
[EMAIL PROTECTED]


_

Re: [Catalyst] help with Catalyst::Plugin::Form::Processor

2007-12-06 Thread Michael Higgins
On Thu, 6 Dec 2007 09:10:32 -0800
Bill Moseley <[EMAIL PROTECTED]> wrote:

> On Thu, Dec 06, 2007 at 07:09:18AM -0800, Michael Higgins wrote:
> 
> Sorry, I missed this question:
> 
> > Will this work without form_widgets.tt or CSS?
> 
> There's no HTML generation code in Form::Processor.  I leave all that
> to the templates.  So, "form_widgets.tt" is an example of a template
> to generate the form and individual fields.  It's a bit ugly of an
> example -- didn't have the time to clean it up nicely for
> distribution.  But, should give you some ideas.
> 
> The reason I leave the html generation to the templates is because the
> markup is often custom to the application.  For example, do you
> include a summary of error messages at the top of your application in
> a message area, or right before the form?  Are error messages
> displayed before the field or after?  Does the application need
> special markup for javascript validation?  Do the form widgets need
> custom class names to work with existing css?
> 
> That kind of markup is always custom, so I just use a template to
> generate it.  And it's abstracted into a single template for all forms
> to use in the application.  Then the individual forms of the
> application can still be custom, but use the application-wide
> template to be consistent.
> 
> 


Thanks a lot for your replies. Yes I did set up and use the example
application. The problem is, I can't make any sense out of the
templates, which seem to do all the work. :(

I can make simple templates, no process, block or wrapper. So, I'm
trying to iterate, somehow, in some rational order, even sorted would
be fine, to expose all the fields in my form.

No wrapper, no Template magic, just the fields I've set up in the same
order each time. With labels, or any other key information, would be
nice...

So, what is the simplest example of returning the form object fields in
a form in TT?

Right now, I'm doing this:


Cheers,

-- 
 |\  /||   |  ~ ~  
 | \/ ||---|  `|` ?
 ||ichael  |   |iggins\^ /
 michael.higgins[at]evolone[dot]org

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] help with Catalyst::Plugin::Form::Processor

2007-12-06 Thread Michael Higgins
On Thu, 6 Dec 2007 10:16:05 -0800
Michael Higgins <[EMAIL PROTECTED]> wrote:

[8<]

> 
> 
> Thanks a lot for your replies. Yes I did set up and use the example
> application. The problem is, I can't make any sense out of the
> templates, which seem to do all the work. :(
> 
> I can make simple templates, no process, block or wrapper. So, I'm
> trying to iterate, somehow, in some rational order, even sorted would
> be fine, to expose all the fields in my form.
> 
> No wrapper, no Template magic, just the fields I've set up in the same
> order each time. With labels, or any other key information, would be
> nice...
> 
> So, what is the simplest example of returning the form object fields
> in a form in TT?
> 
> Right now, I'm doing this:

[Hitting some key combo that sends an email before I'm done writing... ]

Manually set up the form:

 
Data


Manually set up the order of fields:

[% SET fieldlist = ['sh_name','cn_name'] %]


That reference my labels:

[% FOREACH labk IN fieldlist %]

I can expose the form field, finally:

[% SET f = form.field(labk) %]

[% labels.$labk %]


[% END  %]










. . .

What can I do with C::P::Form::Processor (aside from trying to hook
this to my DBIC classes) to make this more... 'elegant'? ;-)

Thanks again.

Cheers,

-- 
 |\  /||   |  ~ ~  
 | \/ ||---|  `|` ?
 ||ichael  |   |iggins\^ /
 michael.higgins[at]evolone[dot]org

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] configurable base url?

2007-12-06 Thread Pablo Collins

Hi all,

I some catalyst apps whose different versions I'd like to make available 
by base path, like


http://mydomain/myspecialapp/version1.2/
http://mydomain/myspecialapp/version1.3/
etc.

I was planning on using a lighttpd or apache proxy to several 
Catalyst::Engine::HTTP processes running the different versions. That 
part is straightforward.


What I'm hung up on is how to tell catalyst to throw away the 
/myspecialapp/version1.3 part of the url and start the controller 
matching from there. I'd like to not have to change the names and 
namespaces of the controllers based on their versions if possible.


Instead I'd like to be able to put the application root url in the 
config and have it just work.


Is this possible / relatively easy to do?

Thanks much.

-Pablo




___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Can't call method "can" on an undefined value in CPAS::DBIC

2007-12-06 Thread Richard Jones
I've been away from Catalyst development for some time to concentrate on 
optimising my database tables. Now I have the new schema I'm getting the 
following error when trying to start the server:


Can't call method "can" on an undefined value at 
/usr/local/share/perl/5.8.7/Catalyst/Plugin/Authentication/Store/DBIC.pm 
line 98. The module in question is at version 0.09.


I'm using DBIx::Class::Schema::Loader to generate the schema 
automatically, but can't seem to make the error go away even when 
reverting to the original schema. Something else has probably changed in 
the meantime which I have overlooked. Does this error mean anything to 
anyone?

--
Richard Jones

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] help with Catalyst::Plugin::Form::Processor

2007-12-06 Thread Bill Moseley
On Thu, Dec 06, 2007 at 07:09:18AM -0800, Michael Higgins wrote:

Sorry, I missed this question:

> Will this work without form_widgets.tt or CSS?

There's no HTML generation code in Form::Processor.  I leave all that
to the templates.  So, "form_widgets.tt" is an example of a template
to generate the form and individual fields.  It's a bit ugly of an
example -- didn't have the time to clean it up nicely for
distribution.  But, should give you some ideas.

The reason I leave the html generation to the templates is because the
markup is often custom to the application.  For example, do you
include a summary of error messages at the top of your application in
a message area, or right before the form?  Are error messages
displayed before the field or after?  Does the application need
special markup for javascript validation?  Do the form widgets need
custom class names to work with existing css?

That kind of markup is always custom, so I just use a template to
generate it.  And it's abstracted into a single template for all forms
to use in the application.  Then the individual forms of the
application can still be custom, but use the application-wide
template to be consistent.


-- 
Bill Moseley
[EMAIL PROTECTED]


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Form::Processor and DBIC

2007-12-06 Thread Bill Moseley
On Thu, Dec 06, 2007 at 11:13:24AM -0500, Gerda Shank wrote:
> I see that Form::Processor works from CDBI. Is there some way to get it 
> to work with DBIC?

Someone familiar with DBIC would need to implement the methods that
are implemented in Form::Processor::Model::CDBI.

http://search.cpan.org/~hank/Form-Processor-0.15/lib/Form/Processor/Model.pm
http://search.cpan.org/~hank/Form-Processor-Model-CDBI-0.06/lib/Form/Processor/Model/CDBI.pm

Which is fetching an item, looking at meta data to determine
relationships (namely for one-to-many select lists and many-to-many
multiple selects).  And how to write the form fields to the database.

-- 
Bill Moseley
[EMAIL PROTECTED]


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] help with Catalyst::Plugin::Form::Processor

2007-12-06 Thread Bill Moseley
On Thu, Dec 06, 2007 at 07:09:18AM -0800, Michael Higgins wrote:
> Hello, list --
> 
> Trying to put this module to use... I got nowhere fast with the docs, a
> little further looking at the examples... until I try to make sense of
> the templates.
> 
> Can anyone show me a simple example of rendering a form with this
> module? I see the form object in a Dumper.dump, so it's all working.
> Now, to View?

Did you try running the example Catalyst application that's included
in the distribution?

-- 
Bill Moseley
[EMAIL PROTECTED]


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Form::Processor and DBIC

2007-12-06 Thread Gerda Shank
I see that Form::Processor works from CDBI. Is there some way to get it 
to work with DBIC?


G.Shank


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: State of t he art in form valid =?WINDOWS-1252?Q?ation ; _opinion_poll=85_Model_based_forms/validation=3F?=

2007-12-06 Thread Bill Moseley
On Thu, Dec 06, 2007 at 03:26:06PM +0200, Valentin Tumarkin wrote:
> I would love to see a single "Form" framework which can be used both
> for HTML and AJAX forms (JSON data).  Imagine having the View (and not
> the Controller) decide how the form will be presented - as HTML or
> ExtJS widgets.

Isn't that how Catalyst works already?

When processing my forms the code has no idea if it was submitted via
AJAX or standard post.  And in the cases where a controller is shared
between AJAX non-AJAX requests the controller typically doesn't know
what the final output will be.

For example, my main template dispatcher knows to not wrap a template
in the site's layout if the request is an AJAX request.  And the view
knows to generate JSON vs.  html, as well.

Indeed, for simple partial page updates via AJAX (sorting, paging)
turning off javascript results in almost all the same code executing.

If I was to start over I might be more inclined to use
Catalyst::Action::REST as described in:

http://catalyst.perl.org/calendar/2006/9
http://catalyst.perl.org/calendar/2007/2

Although, I'm not sure I it can ever be that simple when it comes to
coding the real application.  In general the stash that's needed for
the html template isn't always the same one to expose in JSON or XMLRPC
responses.



-- 
Bill Moseley
[EMAIL PROTECTED]


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] help with Catalyst::Plugin::Form::Processor

2007-12-06 Thread Michael Higgins
Hello, list --

Trying to put this module to use... I got nowhere fast with the docs, a
little further looking at the examples... until I try to make sense of
the templates.

Can anyone show me a simple example of rendering a form with this
module? I see the form object in a Dumper.dump, so it's all working.
Now, to View?

Any help appreciated. Will this work without form_widgets.tt or CSS?

Cheers,

-- 
 |\  /||   |  ~ ~  
 | \/ ||---|  `|` ?
 ||ichael  |   |iggins\^ /
 michael.higgins[at]evolone[dot]org

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: trouble with model->dbic resultset

2007-12-06 Thread Jason Kohles

On Dec 6, 2007, at 7:43 AM, A. Pagaltzis wrote:


* Michael Higgins <[EMAIL PROTECTED]> [2007-12-05 22:40]:

Isn't that some general principle, you find the error just
after emailing a whole bunch of people?


   Another effective [debugging] technique is to explain your
   code to someone else. This will often cause you to explain
   the bug to yourself. Sometimes it takes no more than a few
   sentences, followed by an embarrassed “Never mind. I see
   what’s wrong. Sorry to bother you.” This works remarkbly
   well; you can even use non-programmers as listeners. One
   university computer center kept a teddy bear near the help
   desk. Students with mysterious bugs were required to explain
   them to the bear before they could speak to a human
   counselor.

   —Brian W Kernighan, Rob Pike, “The Practice of Programming”

Reportedly, this noticably reduced the load on the understaffed
centre.

Also be sure and check out "The Contribution of the Cardboard Cutout  
Dog to Software Reliability and Maintainability" (http://www.sjbaker.org/humor/cardboard_dog.html 
)  Which includes a nice table comparing the various attributes  
(Attention Span, Distraction, Feedback, Cost) for a variety of  
listener types, from engineers to restroom attendants.


--
Jason Kohles, RHCA RHCDS RHCE
[EMAIL PROTECTED] - http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: State of the art in form valid =?WINDOWS-1252?Q?ation; _opinion_poll=85_Model_based_forms/validation=3F?=

2007-12-06 Thread Moritz Onken
Hi,

I had the same problem with extJS but I use FormFu. I wrote a pretty
simple extension for FormFu which generates the items-list for ExtJS
from formfu config files.
It supports tables, checkboxes, text, select, date, fieldset etc. Not
everything yet. But I'm on it. Validation, transformation, de/inflation
etc still works.

These forms can be populated by the "default" value of any item. You can
easily turn the Module on or off, so you can get a non-JS version if the
form.

I'm still working on it. But I want to publish it on CPAN.

Regards,

moritz

Am Donnerstag, den 06.12.2007, 15:26 +0200 schrieb Valentin Tumarkin:
> I would love to see a single "Form" framework which can be used both
> for HTML and AJAX forms (JSON data).  Imagine having the View (and not
> the Controller) decide how the form will be presented - as HTML or
> ExtJS widgets.
> 
> I understand that this can be built on top of existing modules, like
> Form::Processor. However with so many existing HTML Form modules out
> there, it seems that this problem would be better solved as a
> plugin/branch of existing High-Level Form module.
> 
> A quick&dirty hack solution would be to write a module which populates
> Catalyst/CGI::FormBuilder form with data taken from JSON object.
> However this alone will not shift the presentation decision to View.
> Also support for hierarchical data structures (JSON) would probably be
> lost.
> 
> A real-life example: one of my work projects is currently using
> Catalyst / FormBuilder. I want to move part of the web interface
> provided by the application to ExtJS, while keeping another part
> compatible with "non-AJAX"  browsers.
> 
> Regards,
> Valentin
> 
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
> Dev site: http://dev.catalyst.perl.org/


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: State of the art in form valid =?WINDOWS-1252?Q?ation; _opinion_poll=85_Model_based_forms/validation=3F?=

2007-12-06 Thread Valentin Tumarkin
I would love to see a single "Form" framework which can be used both
for HTML and AJAX forms (JSON data).  Imagine having the View (and not
the Controller) decide how the form will be presented - as HTML or
ExtJS widgets.

I understand that this can be built on top of existing modules, like
Form::Processor. However with so many existing HTML Form modules out
there, it seems that this problem would be better solved as a
plugin/branch of existing High-Level Form module.

A quick&dirty hack solution would be to write a module which populates
Catalyst/CGI::FormBuilder form with data taken from JSON object.
However this alone will not shift the presentation decision to View.
Also support for hierarchical data structures (JSON) would probably be
lost.

A real-life example: one of my work projects is currently using
Catalyst / FormBuilder. I want to move part of the web interface
provided by the application to ExtJS, while keeping another part
compatible with "non-AJAX"  browsers.

Regards,
Valentin

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: trouble with model->dbic resultset

2007-12-06 Thread Dave Howorth
A. Pagaltzis wrote:
> * Michael Higgins <[EMAIL PROTECTED]> [2007-12-05 22:40]:
>> Isn't that some general principle, you find the error just
>> after emailing a whole bunch of people?
> 
> Another effective [debugging] technique is to explain your
> code to someone else. This will often cause you to explain
> the bug to yourself. Sometimes it takes no more than a few
> sentences, followed by an embarrassed “Never mind. I see
> what’s wrong. Sorry to bother you.” This works remarkbly
> well; you can even use non-programmers as listeners. One
> university computer center kept a teddy bear near the help
> desk. Students with mysterious bugs were required to explain
> them to the bear before they could speak to a human
> counselor.
> 
> —Brian W Kernighan, Rob Pike, “The Practice of Programming”
> 
> Reportedly, this noticably reduced the load on the understaffed
> centre.

We had a teddy bear at one place I worked. I can testify first- and
second-hand that it worked well :)

Cheers, Dave

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: trouble with model->dbic resultset

2007-12-06 Thread Daniel Hulme
On Thu, Dec 06, 2007 at 01:43:32PM +0100, A. Pagaltzis wrote:
> well; you can even use non-programmers as listeners. One
> university computer center kept a teddy bear near the help
> desk. Students with mysterious bugs were required to explain
> them to the bear before they could speak to a human
> counselor.
> 
> —Brian W Kernighan, Rob Pike, “The Practice of Programming”
> 
> Reportedly, this noticably reduced the load on the understaffed
> centre.

I've heard the same story from elsewhere, even including the name of the
teddy bear, which I now forget. I keep a stuffed toy atop my monitor for
the same purpose, and he's really good at spotting mistakes I can't
find.

-- 
"I think you look like the Mona Lisa.  You always seem to be at a window
admiring the landscape that is actually behind you."Herve Le Tellier
http://surreal.istic.org/  There's no CVS in “team”.


signature.asc
Description: Digital signature
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Re: trouble with model->dbic resultset

2007-12-06 Thread A. Pagaltzis
* Michael Higgins <[EMAIL PROTECTED]> [2007-12-05 22:40]:
> Isn't that some general principle, you find the error just
> after emailing a whole bunch of people?

Another effective [debugging] technique is to explain your
code to someone else. This will often cause you to explain
the bug to yourself. Sometimes it takes no more than a few
sentences, followed by an embarrassed “Never mind. I see
what’s wrong. Sorry to bother you.” This works remarkbly
well; you can even use non-programmers as listeners. One
university computer center kept a teddy bear near the help
desk. Students with mysterious bugs were required to explain
them to the bear before they could speak to a human
counselor.

—Brian W Kernighan, Rob Pike, “The Practice of Programming”

Reportedly, this noticably reduced the load on the understaffed
centre.

Regards,
-- 
Aristotle Pagaltzis // 

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: State of the art in form valid =?UTF-8?Q?ation; _opinion_poll=E2=80=A6_Model_based_forms/validation=3F?=

2007-12-06 Thread Zbigniew Lukasiak
By the way - I've created a page on Form Processing at the P5 wiki:
http://www.perlfoundation.org/perl5/index.cgi?form_processing

--
Zbyszek

On Dec 5, 2007 8:25 PM, Ashley Pond V <[EMAIL PROTECTED]> wrote:
> Really good food for thought from everyone. Strangely enough, at
> least when I notice, Bill's code is the most like my own of anyone on
> the list; in approach and style. I'm less certain than ever, of
> course, what I'll end up with but I'm better informed.
>
> Thanks everyone.
>
>
> On Dec 5, 2007, at 4:37 AM, A. Pagaltzis wrote:
>
> > * Bill Moseley <[EMAIL PROTECTED]> [2007-12-05 05:45]:
> >> The Rose form code is very cool. That's what I based my forms
> >> on.
> >
> > Disclaimer: I haven't used Form::Processor. However from what
> > I have seen so far, it seems to solve the *right* problem, with
> > the right level of abstraction for common things and tweakability
> > for individual needs, so it currently seems like the most likely
> > validation framework to work for me.
> >
> >> I don't find automatic form markup creation that useful -- the
> >> forms always seem to need customization.
> >
> > Template system of choice + HTML::FillInForm works for me and
> > keeps things reasonably low-effort.
> >
> > Regards,
> > --
> > Aristotle Pagaltzis // 
> >
> > ___
> > List: Catalyst@lists.scsys.co.uk
> > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> > Searchable archive: http://www.mail-archive.com/
> > [EMAIL PROTECTED]/
> > Dev site: http://dev.catalyst.perl.org/
>
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
> Dev site: http://dev.catalyst.perl.org/
>



-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/