Re: [Mojolicious] Form With Multiple Submit Buttons

2015-10-30 Thread john

Perfect...thanks.

On 10/30/2015 08:44 PM, Keita Sugama wrote:

Hi John.

With this HTML




You will get URLs look like

?button1=push+it+for+foo

So you can detect which one has been pushed by checking the
existence of names in parameter.


On 2015/10/31 4:46, John wrote:

I am on path of a UI that is a single form with submit buttons for
various functions.  In a route I envision taking action based on what
button was selected.

  From Tag Helpers I can see how to assign properties to submit button:

%= submit_button 'Ok!', id => 'foo'

However it is not clear how I can key off id in my route.  The param
property doesn't seem to provide this information.

I am open to any suggestions including "don't do it that way do 
instead" or "this is basic html.  Learn that first".

Thanks,

John



--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Form With Multiple Submit Buttons

2015-10-30 Thread Keita Sugama
Hi John.

With this HTML




You will get URLs look like

?button1=push+it+for+foo

So you can detect which one has been pushed by checking the
existence of names in parameter.


On 2015/10/31 4:46, John wrote:
> I am on path of a UI that is a single form with submit buttons for 
> various functions.  In a route I envision taking action based on what 
> button was selected.
> 
>  From Tag Helpers I can see how to assign properties to submit button:
> 
> %= submit_button 'Ok!', id => 'foo'
> 
> However it is not clear how I can key off id in my route.  The param 
> property doesn't seem to provide this information.
> 
> I am open to any suggestions including "don't do it that way do  
> instead" or "this is basic html.  Learn that first".
> 
> Thanks,
> 
> John
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Form With Multiple Submit Buttons

2015-10-30 Thread John
I am on path of a UI that is a single form with submit buttons for 
various functions.  In a route I envision taking action based on what 
button was selected.


From Tag Helpers I can see how to assign properties to submit button:

%= submit_button 'Ok!', id => 'foo'

However it is not clear how I can key off id in my route.  The param 
property doesn't seem to provide this information.


I am open to any suggestions including "don't do it that way do  
instead" or "this is basic html.  Learn that first".


Thanks,

John

--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Rose relationships in Mojo .ep templates

2015-10-30 Thread Pavel K
Hello,
Its really strange.
Are you defined in your User model
  
column_map => { id_user => 'id_movie' }, ?
in my case 
type => 'one to one';
works great
Also may be you have wrong (not optimal) database structure  ?




пятница, 30 октября 2015 г., 2:37:57 UTC+3 пользователь henq написал:
>
> Hi all, 
> I am using Rose::DB::Object in combination with Mojo. 
> I have hit on an issue, though for the simple case I also have a 
> workaround. The point is that in a Mojo .ep template, the call of a 
> method, generated (I guess) from a defined 'relationship', does not 
> work. To be more precise, the call only seems to work if before the 
> rendering of the template the same method is called in the calling 
> controller. 
> In the code snippets below the problematic method is movies(). 
> So how should we use (or not use) these pseudo-methods of Rose::* in 
> Mojo's .ep templates? 
>
> In the User model, a relationship 'movies' is defined 
> #User.pm 
> use base qw(MyApp::DB::Object); 
> __PACKAGE__->meta->setup ( 
>   table  => 'users', 
>   unique_key => ['user_name'], 
>   auto   => 1, 
>   relationships => 
>   [ movies => 
>  { 
>type => 'many to many', 
>map_class=> 'MyApp::Models::UserMovie', 
>manager_args => { with_map_records => 1 }, 
>  }, 
>] 
>
> In the controller, it seems the call $u->movies is needed; 
>#UserController.pm 
>my $u = 'MyApp::Models::User'->new(user_name => $user_name); 
>$u->load; 
>$u->movies;   #needed !? 
>$shift->stash( user_obj => $u ); 
>#render template 
>
> In the template, ->movies is called but only works if same call is 
> done in controller first. 
>#template.html.ep 
>% foreach( @{$user_obj->movies} ) {  #works only if $u->movies 
> called in controller. 
> 
>% } 
>
> Regards, 
> Henk 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.