[Mojolicious] Re: form validation

2016-12-06 Thread amka1791
Hi,

Your sample works !

One big problem is that when I put "use Mojolicious::Lite;" in the 
controller we speek about, the soft don't work more : I have this error 
message at login :

Page not found... yet! 

None of these routes could generate a response for your GET request for 
/protected, maybe you need to add a new one


But I have in the main file, which worked before "use Mojolicious::Lite;" :


package MyApp;

use Mojo::Base 'Mojolicious';
use MyApp::Model::Users;

sub startup {
  my $self = shift;

  $self->secrets(['Mon applix! mojo premiere']);
  $self->helper(users => sub { state $users = MyApp::Model::Users->new });

  my $r = $self->routes;
  $r->any('/')->to('login#index')->name('index');
 
  my $logged_in = $r->under('/')->to('login#logged_in');
  $logged_in->get('/protected')->to('engrenage#roues');

  $r->get('/logout')->to('login#logout');
  
}

1;

My version :


amel@debian:~/job/RD/mojo/marc$ mojo version
CORE
  Perl(v5.20.2, linux)
  Mojolicious (5.54, Tiger Face)

OPTIONAL
  EV 4.0+ (4.18)
  IO::Socket::IP 0.20+(0.32)
  IO::Socket::Socks 0.64+ (0.65)
  IO::Socket::SSL 1.84+   (2.002)

You might want to update your Mojolicious to 7.11.


Thanks a lot, best regards,


amka











-- 
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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: form validation

2016-12-04 Thread Jan Henning Thorsen
Hey,

Not sure if I understand your problem, but why don't you just use 
$c->validation? Have a look here for more information and 
examples: 
https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Rendering.pod#Form-validation

Which version of Mojolicious do you have? Run "mojo version" to check the 
version.


On Saturday, December 3, 2016 at 1:55:41 PM UTC+1, amka...@gmail.com wrote:
>
> And when I put
>
> my $names = $validation->failed;
>
> I have this message :
>
> Can't locate object method "failed" via package 
> "Mojolicious::Validator::Validation" at 
> /home/amka/job/RAD/mojo/03/script/../lib/MyApp/Controller/En.pm line 35.
>
>
>

-- 
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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: form validation

2016-12-03 Thread amka1791
And when I put

my $names = $validation->failed;

I have this message :

Can't locate object method "failed" via package 
"Mojolicious::Validator::Validation" at 
/home/amka/job/RAD/mojo/03/script/../lib/MyApp/Controller/En.pm line 35.


-- 
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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Form validation and redirects

2015-07-24 Thread Jan Henning Thorsen
"variant", "template" or if/else inside the template.

You decide what is best.

-- 
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: Form validation and redirects

2015-07-24 Thread Vladimir Melnik
Thank you very much, Jan!

On Friday, 24 July 2015 12:07:46 UTC+3, Jan Henning Thorsen wrote:
>
> You should render() when the posted data contain invalid input. Actually, 
> you should almost always render(). The only reason to do a redirect is when 
> you want to avoid the "do you want to repost the form" when someone click 
> the "refresh wheel" or F5.
>
> Remember that you can easily render a completely different template than 
> the default.
>

Did you mean the "variant" attribute, right? 

-- 
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.