I am hoping someone can help me understand how to get this to work as a POST instead of GET. When I do sub below as 'get' it works but when I replace 'get' with 'post' I get:--2015-08-06 13:52:05-- http://0.0.0.0:3000/userConnecting to 0.0.0.0:3000... connected.HTTP request sent, awaiting response... 404 Not Found2015-08-06 13:52:05 ERROR 404: Not Found.package MyApp;use Dancer ':syntax';use Dancer::Plugin::FormValidator;our $VERSION = '0.1';post '/user' => sub { my $input_hash = { FName => param('firstname'), LName => param('lastname'), Email => param('email'), Terms => param('terms'), }; my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; $number_of_defined_values = $number_of_defined_values + 0; if ($number_of_defined_values > 1) { my $error = form_validator_error( 'profile_user', $input_hash ); if ( ! $error ) { #the user provided complete and validates data it's cool to proceed } else { my %hash = %$error; foreach my $k (keys %hash) { return "$k: $hash{$k}\n"; } } } template 'user';##########################################################}; ### end of sub user ###################################true;Thanks in advance for any help.
Hi Richard How are you calling it? You can't just call it by putting the url in your browser since the browser will be making a GET request. I'd use curl as described here http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-t... (or in the 'man curl' page if you read it slowly:) Next question - why are you using Dancer instead of Dancer2? Dancer2 is a redesign to make things more easy/powerful/enjoyable... Andrew On Fri, Aug 7, 2015 at 3:17 PM, Richard Reina <gatorreina@gmail.com> wrote:
I am hoping someone can help me understand how to get this to work as a POST instead of GET. When I do sub below as 'get' it works but when I replace 'get' with 'post' I get:--2015-08-06 13:52:05-- http://0.0.0.0:3000/userConnecting to 0.0.0.0:3000... connected.HTTP request sent, awaiting response... 404 Not Found2015-08-06 13:52:05 ERROR 404: Not Found.package MyApp;use Dancer ':syntax';use Dancer::Plugin::FormValidator;our $VERSION = '0.1';post '/user' => sub { my $input_hash = { FName => param('firstname'), LName => param('lastname'), Email => param('email'), Terms => param('terms'), }; my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; $number_of_defined_values = $number_of_defined_values + 0; if ($number_of_defined_values > 1) { my $error = form_validator_error( 'profile_user', $input_hash ); if ( ! $error ) { #the user provided complete and validates data it's cool to proceed } else { my %hash = %$error; foreach my $k (keys %hash) { return "$k: $hash{$k}\n"; } } } template 'user';##########################################################}; ### end of sub user ###################################true;Thanks in advance for any help.
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- Andrew Solomon Mentor@Geekuni http://geekuni.com/ http://www.linkedin.com/in/asolomon
Hi Andrew, Let me answer your second question first -- as will bear insight to my answer of the second question. I am using dancer instead of dancer2 because I am too clueless to know any better. I will look to migrate to dancer2 although I am not sure what that entails -- hope my kids and wife remember what I look like. About how I call it. I am confused here as well. I am merely typing it in the url. I am trying to create a new user login page that will ultimately be a link from my home page. So I will need for it to work as mydomain.com/user. I am afraid I don't know how else to "call" it and confess that I don't completely understand what "call" it means. I just don't want to use GET as it makes the info appears in the url. Thanks again 2015-08-07 9:30 GMT-05:00 Andrew Solomon <andrew@geekuni.com>:
Hi Richard
How are you calling it? You can't just call it by putting the url in your browser since the browser will be making a GET request. I'd use curl as described here
http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-t...
(or in the 'man curl' page if you read it slowly:)
Next question - why are you using Dancer instead of Dancer2?
Dancer2 is a redesign to make things more easy/powerful/enjoyable...
Andrew
On Fri, Aug 7, 2015 at 3:17 PM, Richard Reina <gatorreina@gmail.com> wrote:
I am hoping someone can help me understand how to get this to work as a POST instead of GET. When I do sub below as 'get' it works but when I replace 'get' with 'post' I get:--2015-08-06 13:52:05-- http://0.0.0.0:3000/userConnecting to 0.0.0.0:3000... connected.HTTP request sent, awaiting response... 404 Not Found2015-08-06 13:52:05 ERROR 404: Not Found.package MyApp;use Dancer ':syntax';use Dancer::Plugin::FormValidator;our $VERSION = '0.1';post '/user' => sub { my $input_hash = { FName => param('firstname'), LName => param('lastname'), Email => param('email'), Terms => param('terms'), }; my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; $number_of_defined_values = $number_of_defined_values + 0; if ($number_of_defined_values > 1) { my $error = form_validator_error( 'profile_user', $input_hash ); if ( ! $error ) { #the user provided complete and validates data it's cool to proceed } else { my %hash = %$error; foreach my $k (keys %hash) { return "$k: $hash{$k}\n"; } } } template 'user';##########################################################}; ### end of sub user ###################################true;Thanks in advance for any help.
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- Andrew Solomon
Mentor@Geekuni http://geekuni.com/ http://www.linkedin.com/in/asolomon
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
You need to build a web page with a FORM first, then submit the data that way to the /user URL, so it can get handled. Try using git to clone this repository and use that as a base for your playing around: https://github.com/agordon/dancer_bootstrap_fontawesome_template.git I don't have any working examples handy right this second... Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get: Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found. Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator; Richard> our $VERSION = '0.1'; Richard> post '/user' => sub { Richard> my $input_hash = { Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'), Richard> }; Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0; Richard> if ($number_of_defined_values > 1) { Richard> my $error = form_validator_error( 'profile_user', $input_hash ); Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed Richard> } else { Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n"; Richard> } Richard> } Richard> } Richard> template 'user'; Richard> ########################################################## Richard> }; ### end of sub user ################################### Richard> true; Richard> Thanks in advance for any help. Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I am using for the form. <!DOCTYPE html> <html> <body> <h1>Get in the game.</h1> <form> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form> <p>Note that the form itself is not visible.</p> <p>Also note that the default width of a text field is 20 characters.</p> </body> </html> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org>:
You need to build a web page with a FORM first, then submit the data that way to the /user URL, so it can get handled.
Try using git to clone this repository and use that as a base for your playing around:
https://github.com/agordon/dancer_bootstrap_fontawesome_template.git
I don't have any working examples handy right this second...
Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get:
Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.
Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator;
Richard> our $VERSION = '0.1';
Richard> post '/user' => sub {
Richard> my $input_hash = {
Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'),
Richard> };
Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0;
Richard> if ($number_of_defined_values > 1) {
Richard> my $error = form_validator_error( 'profile_user', $input_hash );
Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed
Richard> } else {
Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n";
Richard> }
Richard> } Richard> }
Richard> template 'user';
Richard> ########################################################## Richard> }; ### end of sub user ###################################
Richard> true;
Richard> Thanks in advance for any help.
Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
I think what you're after is something like this to tell the browser you want to POST: <form action="http://localhost:3000/user" method="POST"> Does that do the trick? A On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina <gatorreina@gmail.com> wrote:
Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I am using for the form.
<!DOCTYPE html> <html> <body>
<h1>Get in the game.</h1>
<form> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form>
<p>Note that the form itself is not visible.</p>
<p>Also note that the default width of a text field is 20 characters.</p>
</body> </html>
2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org>:
You need to build a web page with a FORM first, then submit the data that way to the /user URL, so it can get handled.
Try using git to clone this repository and use that as a base for your playing around:
https://github.com/agordon/dancer_bootstrap_fontawesome_template.git
I don't have any working examples handy right this second...
Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get:
Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.
Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator;
Richard> our $VERSION = '0.1';
Richard> post '/user' => sub {
Richard> my $input_hash = {
Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'),
Richard> };
Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0;
Richard> if ($number_of_defined_values > 1) {
Richard> my $error = form_validator_error( 'profile_user', $input_hash );
Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed
Richard> } else {
Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n";
Richard> }
Richard> } Richard> }
Richard> template 'user';
Richard> ########################################################## Richard> }; ### end of sub user ###################################
Richard> true;
Richard> Thanks in advance for any help.
Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- Andrew Solomon Mentor@Geekuni http://geekuni.com/ http://www.linkedin.com/in/asolomon
And I know there's a helper you can use to fill in the action so that you don't have to update the URLs when you deploy it elsewhere.... but I'm at work and not near my notes... Ah... here it is. Just do: <form action="user"> And I think you also want to remove the <!DOCTYPE html> as well, since this template will get embedded into alayout which will take care of all that stuff. John Andrew> I think what you're after is something like this to tell the browser you want to POST: Andrew> <form action="http://localhost:3000/user" method="POST"> Andrew> Does that do the trick? Andrew> A Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina <gatorreina@gmail.com> wrote: Andrew> Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I Andrew> am using for the form. Andrew> <!DOCTYPE html> Andrew> <html> Andrew> <body> Andrew> <h1>Get in the game.</h1> Andrew> <form> Andrew> First name:<br> Andrew> <input type="text" name="firstname"> Andrew> <br> Andrew> Last name:<br> Andrew> <input type="text" name="lastname"> Andrew> <br> Andrew> Email Address:<br> Andrew> <input type="text" name="email"> Andrew> <br> Andrew> User Password:<br> Andrew> <input type="password" name="psw"> Andrew> <br> Andrew> User Confirm Password:<br> Andrew> <input type="password" name="psw2"> Andrew> <br> Andrew> Terms & Conditions Andrew> <input type="checkbox" name="terms"> I agree with terms and conditions.<br> Andrew> <br> Andrew> <input type="submit" value="Go" /> Andrew> </form> Andrew> <p>Note that the form itself is not visible.</p> Andrew> <p>Also note that the default width of a text field is 20 characters.</p> Andrew> </body> Andrew> </html> Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org>: Andrew> You need to build a web page with a FORM first, then submit the data Andrew> that way to the /user URL, so it can get handled. Andrew> Try using git to clone this repository and use that as a base for your Andrew> playing around: Andrew> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git Andrew> I don't have any working examples handy right this second... Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get: Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found. Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator; Richard> our $VERSION = '0.1'; Richard> post '/user' => sub { Richard> my $input_hash = { Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'), Richard> }; Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0; Richard> if ($number_of_defined_values > 1) { Richard> my $error = form_validator_error( 'profile_user', $input_hash ); Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed Richard> } else { Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n"; Richard> } Richard> } Richard> } Richard> template 'user'; Richard> ########################################################## Richard> }; ### end of sub user ################################### Richard> true; Richard> Thanks in advance for any help. Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> -- Andrew> Andrew Solomon Andrew> Mentor@Geekuni http://geekuni.com/ Andrew> http://www.linkedin.com/in/asolomon Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
replacing the first few lines with: <html> <body> <h1>Get in the game.</h1> <form action="user" method="POST"> First name:<br> I still get Error 404 Interestingly enough when I modify this http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit to method="POST" it does not work either. 2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>:
And I know there's a helper you can use to fill in the action so that you don't have to update the URLs when you deploy it elsewhere.... but I'm at work and not near my notes...
Ah... here it is. Just do:
<form action="user">
And I think you also want to remove the <!DOCTYPE html> as well, since this template will get embedded into alayout which will take care of all that stuff.
John
Andrew> I think what you're after is something like this to tell the browser you want to POST: Andrew> <form action="http://localhost:3000/user" method="POST">
Andrew> Does that do the trick?
Andrew> A
Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < gatorreina@gmail.com> wrote:
Andrew> Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I Andrew> am using for the form.
Andrew> <!DOCTYPE html> Andrew> <html> Andrew> <body>
Andrew> <h1>Get in the game.</h1>
Andrew> <form> Andrew> First name:<br> Andrew> <input type="text" name="firstname"> Andrew> <br> Andrew> Last name:<br> Andrew> <input type="text" name="lastname"> Andrew> <br> Andrew> Email Address:<br> Andrew> <input type="text" name="email"> Andrew> <br> Andrew> User Password:<br> Andrew> <input type="password" name="psw"> Andrew> <br> Andrew> User Confirm Password:<br> Andrew> <input type="password" name="psw2"> Andrew> <br> Andrew> Terms & Conditions Andrew> <input type="checkbox" name="terms"> I agree with terms and conditions.<br> Andrew> <br> Andrew> <input type="submit" value="Go" /> Andrew> </form>
Andrew> <p>Note that the form itself is not visible.</p>
Andrew> <p>Also note that the default width of a text field is 20 characters.</p>
Andrew> </body> Andrew> </html>
Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew> You need to build a web page with a FORM first, then submit the data Andrew> that way to the /user URL, so it can get handled.
Andrew> Try using git to clone this repository and use that as a base for your Andrew> playing around:
Andrew> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git
Andrew> I don't have any working examples handy right this second...
Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get:
Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.
Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator;
Richard> our $VERSION = '0.1';
Richard> post '/user' => sub {
Richard> my $input_hash = {
Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'),
Richard> };
Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0;
Richard> if ($number_of_defined_values > 1) {
Richard> my $error = form_validator_error( 'profile_user', $input_hash );
Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed
Richard> } else {
Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n";
Richard> }
Richard> } Richard> }
Richard> template 'user';
Richard> ########################################################## Richard> }; ### end of sub user ###################################
Richard> true;
Richard> Thanks in advance for any help.
Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> -- Andrew> Andrew Solomon
Andrew> Mentor@Geekuni http://geekuni.com/ Andrew> http://www.linkedin.com/in/asolomon
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
This is my dancer console output. 2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
replacing the first few lines with:
<html> <body>
<h1>Get in the game.</h1>
<form action="user" method="POST"> First name:<br>
I still get Error 404
Interestingly enough when I modify this http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit to method="POST" it does not work either.
2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>:
And I know there's a helper you can use to fill in the action so that you don't have to update the URLs when you deploy it elsewhere.... but I'm at work and not near my notes...
Ah... here it is. Just do:
<form action="user">
And I think you also want to remove the <!DOCTYPE html> as well, since this template will get embedded into alayout which will take care of all that stuff.
John
Andrew> I think what you're after is something like this to tell the browser you want to POST: Andrew> <form action="http://localhost:3000/user" method="POST">
Andrew> Does that do the trick?
Andrew> A
Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < gatorreina@gmail.com> wrote:
Andrew> Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I Andrew> am using for the form.
Andrew> <!DOCTYPE html> Andrew> <html> Andrew> <body>
Andrew> <h1>Get in the game.</h1>
Andrew> <form> Andrew> First name:<br> Andrew> <input type="text" name="firstname"> Andrew> <br> Andrew> Last name:<br> Andrew> <input type="text" name="lastname"> Andrew> <br> Andrew> Email Address:<br> Andrew> <input type="text" name="email"> Andrew> <br> Andrew> User Password:<br> Andrew> <input type="password" name="psw"> Andrew> <br> Andrew> User Confirm Password:<br> Andrew> <input type="password" name="psw2"> Andrew> <br> Andrew> Terms & Conditions Andrew> <input type="checkbox" name="terms"> I agree with terms and conditions.<br> Andrew> <br> Andrew> <input type="submit" value="Go" /> Andrew> </form>
Andrew> <p>Note that the form itself is not visible.</p>
Andrew> <p>Also note that the default width of a text field is 20 characters.</p>
Andrew> </body> Andrew> </html>
Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew> You need to build a web page with a FORM first, then submit the data Andrew> that way to the /user URL, so it can get handled.
Andrew> Try using git to clone this repository and use that as a base for your Andrew> playing around:
Andrew> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git
Andrew> I don't have any working examples handy right this second...
Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get:
Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.
Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator;
Richard> our $VERSION = '0.1';
Richard> post '/user' => sub {
Richard> my $input_hash = {
Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'),
Richard> };
Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0;
Richard> if ($number_of_defined_values > 1) {
Richard> my $error = form_validator_error( 'profile_user', $input_hash );
Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed
Richard> } else {
Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n";
Richard> }
Richard> } Richard> }
Richard> template 'user';
Richard> ########################################################## Richard> }; ### end of sub user ###################################
Richard> true;
Richard> Thanks in advance for any help.
Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> -- Andrew> Andrew Solomon
Andrew> Mentor@Geekuni http://geekuni.com/ Andrew> http://www.linkedin.com/in/asolomon
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Sorry this is my dancer console output:
Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 Dancer::Plugin::FormValidator (1.131620) == Entering the development dance floor ... [24745] core @0.000165> request: GET /user from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181
2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
This is my dancer console output.
2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
replacing the first few lines with:
<html> <body>
<h1>Get in the game.</h1>
<form action="user" method="POST"> First name:<br>
I still get Error 404
Interestingly enough when I modify this http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit to method="POST" it does not work either.
2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>:
And I know there's a helper you can use to fill in the action so that you don't have to update the URLs when you deploy it elsewhere.... but I'm at work and not near my notes...
Ah... here it is. Just do:
<form action="user">
And I think you also want to remove the <!DOCTYPE html> as well, since this template will get embedded into alayout which will take care of all that stuff.
John
Andrew> I think what you're after is something like this to tell the browser you want to POST: Andrew> <form action="http://localhost:3000/user" method="POST">
Andrew> Does that do the trick?
Andrew> A
Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < gatorreina@gmail.com> wrote:
Andrew> Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I Andrew> am using for the form.
Andrew> <!DOCTYPE html> Andrew> <html> Andrew> <body>
Andrew> <h1>Get in the game.</h1>
Andrew> <form> Andrew> First name:<br> Andrew> <input type="text" name="firstname"> Andrew> <br> Andrew> Last name:<br> Andrew> <input type="text" name="lastname"> Andrew> <br> Andrew> Email Address:<br> Andrew> <input type="text" name="email"> Andrew> <br> Andrew> User Password:<br> Andrew> <input type="password" name="psw"> Andrew> <br> Andrew> User Confirm Password:<br> Andrew> <input type="password" name="psw2"> Andrew> <br> Andrew> Terms & Conditions Andrew> <input type="checkbox" name="terms"> I agree with terms and conditions.<br> Andrew> <br> Andrew> <input type="submit" value="Go" /> Andrew> </form>
Andrew> <p>Note that the form itself is not visible.</p>
Andrew> <p>Also note that the default width of a text field is 20 characters.</p>
Andrew> </body> Andrew> </html>
Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew> You need to build a web page with a FORM first, then submit the data Andrew> that way to the /user URL, so it can get handled.
Andrew> Try using git to clone this repository and use that as a base for your Andrew> playing around:
Andrew> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git
Andrew> I don't have any working examples handy right this second...
Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get:
Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.
Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator;
Richard> our $VERSION = '0.1';
Richard> post '/user' => sub {
Richard> my $input_hash = {
Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'),
Richard> };
Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0;
Richard> if ($number_of_defined_values > 1) {
Richard> my $error = form_validator_error( 'profile_user', $input_hash );
Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed
Richard> } else {
Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n";
Richard> }
Richard> } Richard> }
Richard> template 'user';
Richard> ########################################################## Richard> }; ### end of sub user ###################################
Richard> true;
Richard> Thanks in advance for any help.
Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> -- Andrew> Andrew Solomon
Andrew> Mentor@Geekuni http://geekuni.com/ Andrew> http://www.linkedin.com/in/asolomon
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
That looks very much like you're only managing to make GET calls. I suggest you use curl at the command-line at the outset, then you can struggle with getting your browser to obey:) Andrew On Fri, Aug 7, 2015 at 5:58 PM, Richard Reina <gatorreina@gmail.com> wrote:
Sorry this is my dancer console output:
Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 Dancer::Plugin::FormValidator (1.131620) == Entering the development dance floor ... [24745] core @0.000165> request: GET /user from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181
2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
This is my dancer console output.
2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
replacing the first few lines with:
<html> <body>
<h1>Get in the game.</h1>
<form action="user" method="POST"> First name:<br>
I still get Error 404
Interestingly enough when I modify this http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit to method="POST" it does not work either.
2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>:
And I know there's a helper you can use to fill in the action so that you don't have to update the URLs when you deploy it elsewhere.... but I'm at work and not near my notes...
Ah... here it is. Just do:
<form action="user">
And I think you also want to remove the <!DOCTYPE html> as well, since this template will get embedded into alayout which will take care of all that stuff.
John
Andrew> I think what you're after is something like this to tell the browser you want to POST: Andrew> <form action="http://localhost:3000/user" method="POST">
Andrew> Does that do the trick?
Andrew> A
Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < gatorreina@gmail.com> wrote:
Andrew> Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I Andrew> am using for the form.
Andrew> <!DOCTYPE html> Andrew> <html> Andrew> <body>
Andrew> <h1>Get in the game.</h1>
Andrew> <form> Andrew> First name:<br> Andrew> <input type="text" name="firstname"> Andrew> <br> Andrew> Last name:<br> Andrew> <input type="text" name="lastname"> Andrew> <br> Andrew> Email Address:<br> Andrew> <input type="text" name="email"> Andrew> <br> Andrew> User Password:<br> Andrew> <input type="password" name="psw"> Andrew> <br> Andrew> User Confirm Password:<br> Andrew> <input type="password" name="psw2"> Andrew> <br> Andrew> Terms & Conditions Andrew> <input type="checkbox" name="terms"> I agree with terms and conditions.<br> Andrew> <br> Andrew> <input type="submit" value="Go" /> Andrew> </form>
Andrew> <p>Note that the form itself is not visible.</p>
Andrew> <p>Also note that the default width of a text field is 20 characters.</p>
Andrew> </body> Andrew> </html>
Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew> You need to build a web page with a FORM first, then submit the data Andrew> that way to the /user URL, so it can get handled.
Andrew> Try using git to clone this repository and use that as a base for your Andrew> playing around:
Andrew> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git
Andrew> I don't have any working examples handy right this second...
Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get:
Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.
Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator;
Richard> our $VERSION = '0.1';
Richard> post '/user' => sub {
Richard> my $input_hash = {
Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'),
Richard> };
Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0;
Richard> if ($number_of_defined_values > 1) {
Richard> my $error = form_validator_error( 'profile_user', $input_hash );
Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed
Richard> } else {
Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n";
Richard> }
Richard> } Richard> }
Richard> template 'user';
Richard> ########################################################## Richard> }; ### end of sub user ###################################
Richard> true;
Richard> Thanks in advance for any help.
Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> -- Andrew> Andrew Solomon
Andrew> Mentor@Geekuni http://geekuni.com/ Andrew> http://www.linkedin.com/in/asolomon
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- Andrew Solomon Mentor@Geekuni http://geekuni.com/ http://www.linkedin.com/in/asolomon
Here is what I get from curl. curl http://0.0.0.0:3000/user <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Error 404</title> <link rel="stylesheet" href="/css/error.css" /> <meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> </head> <body> <h1>Error 404</h1> <div id="content"> <h2>Page Not Found</h2><p>Sorry, this is the void.</p> </div> <div id="footer"> Powered by <a href="http://perldancer.org/">Dancer</a>. </div> </body> </html> 2015-08-07 12:12 GMT-05:00 Andrew Solomon <andrew@geekuni.com>:
That looks very much like you're only managing to make GET calls. I suggest you use curl at the command-line at the outset, then you can struggle with getting your browser to obey:)
Andrew
On Fri, Aug 7, 2015 at 5:58 PM, Richard Reina <gatorreina@gmail.com> wrote:
Sorry this is my dancer console output:
Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 Dancer::Plugin::FormValidator (1.131620) == Entering the development dance floor ... [24745] core @0.000165> request: GET /user from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181
2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
This is my dancer console output.
2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
replacing the first few lines with:
<html> <body>
<h1>Get in the game.</h1>
<form action="user" method="POST"> First name:<br>
I still get Error 404
Interestingly enough when I modify this http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit to method="POST" it does not work either.
2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>:
And I know there's a helper you can use to fill in the action so that you don't have to update the URLs when you deploy it elsewhere.... but I'm at work and not near my notes...
Ah... here it is. Just do:
<form action="user">
And I think you also want to remove the <!DOCTYPE html> as well, since this template will get embedded into alayout which will take care of all that stuff.
John
Andrew> I think what you're after is something like this to tell the browser you want to POST: Andrew> <form action="http://localhost:3000/user" method="POST">
Andrew> Does that do the trick?
Andrew> A
Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < gatorreina@gmail.com> wrote:
Andrew> Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I Andrew> am using for the form.
Andrew> <!DOCTYPE html> Andrew> <html> Andrew> <body>
Andrew> <h1>Get in the game.</h1>
Andrew> <form> Andrew> First name:<br> Andrew> <input type="text" name="firstname"> Andrew> <br> Andrew> Last name:<br> Andrew> <input type="text" name="lastname"> Andrew> <br> Andrew> Email Address:<br> Andrew> <input type="text" name="email"> Andrew> <br> Andrew> User Password:<br> Andrew> <input type="password" name="psw"> Andrew> <br> Andrew> User Confirm Password:<br> Andrew> <input type="password" name="psw2"> Andrew> <br> Andrew> Terms & Conditions Andrew> <input type="checkbox" name="terms"> I agree with terms and conditions.<br> Andrew> <br> Andrew> <input type="submit" value="Go" /> Andrew> </form>
Andrew> <p>Note that the form itself is not visible.</p>
Andrew> <p>Also note that the default width of a text field is 20 characters.</p>
Andrew> </body> Andrew> </html>
Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew> You need to build a web page with a FORM first, then submit the data Andrew> that way to the /user URL, so it can get handled.
Andrew> Try using git to clone this repository and use that as a base for your Andrew> playing around:
Andrew> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git
Andrew> I don't have any working examples handy right this second...
Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get:
Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.
Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator;
Richard> our $VERSION = '0.1';
Richard> post '/user' => sub {
Richard> my $input_hash = {
Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'),
Richard> };
Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0;
Richard> if ($number_of_defined_values > 1) {
Richard> my $error = form_validator_error( 'profile_user', $input_hash );
Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed
Richard> } else {
Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n";
Richard> }
Richard> } Richard> }
Richard> template 'user';
Richard> ########################################################## Richard> }; ### end of sub user ###################################
Richard> true;
Richard> Thanks in advance for any help.
Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> -- Andrew> Andrew Solomon
Andrew> Mentor@Geekuni http://geekuni.com/ Andrew> http://www.linkedin.com/in/asolomon
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- Andrew Solomon
Mentor@Geekuni http://geekuni.com/ http://www.linkedin.com/in/asolomon
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Hi Richard, Did you restart server after you changed GET with POST at form definition? On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com> wrote:
Sorry this is my dancer console output:
Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 Dancer::Plugin::FormValidator (1.131620) == Entering the development dance floor ... [24745] core @0.000165> request: GET /user from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181
2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
This is my dancer console output.
2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
replacing the first few lines with:
<html> <body>
<h1>Get in the game.</h1>
<form action="user" method="POST"> First name:<br>
I still get Error 404
Interestingly enough when I modify this http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit to method="POST" it does not work either.
2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>:
And I know there's a helper you can use to fill in the action so that you don't have to update the URLs when you deploy it elsewhere.... but I'm at work and not near my notes...
Ah... here it is. Just do:
<form action="user">
And I think you also want to remove the <!DOCTYPE html> as well, since this template will get embedded into alayout which will take care of all that stuff.
John
Andrew> I think what you're after is something like this to tell the browser you want to POST: Andrew> <form action="http://localhost:3000/user" method="POST">
Andrew> Does that do the trick?
Andrew> A
Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < gatorreina@gmail.com> wrote:
Andrew> Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I Andrew> am using for the form.
Andrew> <!DOCTYPE html> Andrew> <html> Andrew> <body>
Andrew> <h1>Get in the game.</h1>
Andrew> <form> Andrew> First name:<br> Andrew> <input type="text" name="firstname"> Andrew> <br> Andrew> Last name:<br> Andrew> <input type="text" name="lastname"> Andrew> <br> Andrew> Email Address:<br> Andrew> <input type="text" name="email"> Andrew> <br> Andrew> User Password:<br> Andrew> <input type="password" name="psw"> Andrew> <br> Andrew> User Confirm Password:<br> Andrew> <input type="password" name="psw2"> Andrew> <br> Andrew> Terms & Conditions Andrew> <input type="checkbox" name="terms"> I agree with terms and conditions.<br> Andrew> <br> Andrew> <input type="submit" value="Go" /> Andrew> </form>
Andrew> <p>Note that the form itself is not visible.</p>
Andrew> <p>Also note that the default width of a text field is 20 characters.</p>
Andrew> </body> Andrew> </html>
Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew> You need to build a web page with a FORM first, then submit the data Andrew> that way to the /user URL, so it can get handled.
Andrew> Try using git to clone this repository and use that as a base for your Andrew> playing around:
Andrew> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git
Andrew> I don't have any working examples handy right this second...
Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get:
Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.
Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator;
Richard> our $VERSION = '0.1';
Richard> post '/user' => sub {
Richard> my $input_hash = {
Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'),
Richard> };
Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0;
Richard> if ($number_of_defined_values > 1) {
Richard> my $error = form_validator_error( 'profile_user', $input_hash );
Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed
Richard> } else {
Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n";
Richard> }
Richard> } Richard> }
Richard> template 'user';
Richard> ########################################################## Richard> }; ### end of sub user ###################################
Richard> true;
Richard> Thanks in advance for any help.
Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> -- Andrew> Andrew Solomon
Andrew> Mentor@Geekuni http://geekuni.com/ Andrew> http://www.linkedin.com/in/asolomon
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- *Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00*
Yes and just did and tried again to make sure. 2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Hi Richard,
Did you restart server after you changed GET with POST at form definition?
On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com> wrote:
Sorry this is my dancer console output:
Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 Dancer::Plugin::FormValidator (1.131620) == Entering the development dance floor ... [24745] core @0.000165> request: GET /user from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181
2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
This is my dancer console output.
2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
replacing the first few lines with:
<html> <body>
<h1>Get in the game.</h1>
<form action="user" method="POST"> First name:<br>
I still get Error 404
Interestingly enough when I modify this http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit to method="POST" it does not work either.
2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>:
And I know there's a helper you can use to fill in the action so that you don't have to update the URLs when you deploy it elsewhere.... but I'm at work and not near my notes...
Ah... here it is. Just do:
<form action="user">
And I think you also want to remove the <!DOCTYPE html> as well, since this template will get embedded into alayout which will take care of all that stuff.
John
Andrew> I think what you're after is something like this to tell the browser you want to POST: Andrew> <form action="http://localhost:3000/user" method="POST">
Andrew> Does that do the trick?
Andrew> A
Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < gatorreina@gmail.com> wrote:
Andrew> Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I Andrew> am using for the form.
Andrew> <!DOCTYPE html> Andrew> <html> Andrew> <body>
Andrew> <h1>Get in the game.</h1>
Andrew> <form> Andrew> First name:<br> Andrew> <input type="text" name="firstname"> Andrew> <br> Andrew> Last name:<br> Andrew> <input type="text" name="lastname"> Andrew> <br> Andrew> Email Address:<br> Andrew> <input type="text" name="email"> Andrew> <br> Andrew> User Password:<br> Andrew> <input type="password" name="psw"> Andrew> <br> Andrew> User Confirm Password:<br> Andrew> <input type="password" name="psw2"> Andrew> <br> Andrew> Terms & Conditions Andrew> <input type="checkbox" name="terms"> I agree with terms and conditions.<br> Andrew> <br> Andrew> <input type="submit" value="Go" /> Andrew> </form>
Andrew> <p>Note that the form itself is not visible.</p>
Andrew> <p>Also note that the default width of a text field is 20 characters.</p>
Andrew> </body> Andrew> </html>
Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew> You need to build a web page with a FORM first, then submit the data Andrew> that way to the /user URL, so it can get handled.
Andrew> Try using git to clone this repository and use that as a base for your Andrew> playing around:
Andrew> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git
Andrew> I don't have any working examples handy right this second...
Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get:
Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.
Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator;
Richard> our $VERSION = '0.1';
Richard> post '/user' => sub {
Richard> my $input_hash = {
Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'),
Richard> };
Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0;
Richard> if ($number_of_defined_values > 1) {
Richard> my $error = form_validator_error( 'profile_user', $input_hash );
Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed
Richard> } else {
Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n";
Richard> }
Richard> } Richard> }
Richard> template 'user';
Richard> ########################################################## Richard> }; ### end of sub user ###################################
Richard> true;
Richard> Thanks in advance for any help.
Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> -- Andrew> Andrew Solomon
Andrew> Mentor@Geekuni http://geekuni.com/ Andrew> http://www.linkedin.com/in/asolomon
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Richard, Would you please copy template 'user' here? If everything is OK, when you click on "Go" button, POST requests will be performed On Fri, Aug 7, 2015 at 8:30 PM, Richard Reina <gatorreina@gmail.com> wrote:
Yes and just did and tried again to make sure.
2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Hi Richard,
Did you restart server after you changed GET with POST at form definition?
On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com> wrote:
Sorry this is my dancer console output:
Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 Dancer::Plugin::FormValidator (1.131620) == Entering the development dance floor ... [24745] core @0.000165> request: GET /user from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181
2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
This is my dancer console output.
2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
replacing the first few lines with:
<html> <body>
<h1>Get in the game.</h1>
<form action="user" method="POST"> First name:<br>
I still get Error 404
Interestingly enough when I modify this http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit to method="POST" it does not work either.
2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>:
And I know there's a helper you can use to fill in the action so that you don't have to update the URLs when you deploy it elsewhere.... but I'm at work and not near my notes...
Ah... here it is. Just do:
<form action="user">
And I think you also want to remove the <!DOCTYPE html> as well, since this template will get embedded into alayout which will take care of all that stuff.
John
Andrew> I think what you're after is something like this to tell the browser you want to POST: Andrew> <form action="http://localhost:3000/user" method="POST">
Andrew> Does that do the trick?
Andrew> A
Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < gatorreina@gmail.com> wrote:
Andrew> Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I Andrew> am using for the form.
Andrew> <!DOCTYPE html> Andrew> <html> Andrew> <body>
Andrew> <h1>Get in the game.</h1>
Andrew> <form> Andrew> First name:<br> Andrew> <input type="text" name="firstname"> Andrew> <br> Andrew> Last name:<br> Andrew> <input type="text" name="lastname"> Andrew> <br> Andrew> Email Address:<br> Andrew> <input type="text" name="email"> Andrew> <br> Andrew> User Password:<br> Andrew> <input type="password" name="psw"> Andrew> <br> Andrew> User Confirm Password:<br> Andrew> <input type="password" name="psw2"> Andrew> <br> Andrew> Terms & Conditions Andrew> <input type="checkbox" name="terms"> I agree with terms and conditions.<br> Andrew> <br> Andrew> <input type="submit" value="Go" /> Andrew> </form>
Andrew> <p>Note that the form itself is not visible.</p>
Andrew> <p>Also note that the default width of a text field is 20 characters.</p>
Andrew> </body> Andrew> </html>
Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org >:
Andrew> You need to build a web page with a FORM first, then submit the data Andrew> that way to the /user URL, so it can get handled.
Andrew> Try using git to clone this repository and use that as a base for your Andrew> playing around:
Andrew> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git
Andrew> I don't have any working examples handy right this second...
Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get:
Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.
Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator;
Richard> our $VERSION = '0.1';
Richard> post '/user' => sub {
Richard> my $input_hash = {
Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'),
Richard> };
Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0;
Richard> if ($number_of_defined_values > 1) {
Richard> my $error = form_validator_error( 'profile_user', $input_hash );
Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed
Richard> } else {
Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n";
Richard> }
Richard> } Richard> }
Richard> template 'user';
Richard> ########################################################## Richard> }; ### end of sub user ###################################
Richard> true;
Richard> Thanks in advance for any help.
Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> -- Andrew> Andrew Solomon
Andrew> Mentor@Geekuni http://geekuni.com/ Andrew> http://www.linkedin.com/in/asolomon
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- *Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00*
I can't get the page to appear in the browser so I can't press the Go button. I get: Error 404 Page Not Found Sorry, this is the void. Powered by Dancer <http://perldancer.org/>. This is user.tt <!DOCTYPE html> <html> <body> <h1>Get in the game.</h1> <form action="user" method="post"> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form> <p>Note that the form itself is not visible.</p> <p>Also note that the default width of a text field is 20 characters.</p> </body> </html> 2015-08-07 12:38 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Richard,
Would you please copy template 'user' here? If everything is OK, when you click on "Go" button, POST requests will be performed
On Fri, Aug 7, 2015 at 8:30 PM, Richard Reina <gatorreina@gmail.com> wrote:
Yes and just did and tried again to make sure.
2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Hi Richard,
Did you restart server after you changed GET with POST at form definition?
On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com> wrote:
Sorry this is my dancer console output:
Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 Dancer::Plugin::FormValidator (1.131620) == Entering the development dance floor ... [24745] core @0.000165> request: GET /user from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181
2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
This is my dancer console output.
2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
replacing the first few lines with:
<html> <body>
<h1>Get in the game.</h1>
<form action="user" method="POST"> First name:<br>
I still get Error 404
Interestingly enough when I modify this http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit to method="POST" it does not work either.
2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>:
> > And I know there's a helper you can use to fill in the action so that > you don't have to update the URLs when you deploy it elsewhere.... > but > I'm at work and not near my notes... > > Ah... here it is. Just do: > > <form action="user"> > > And I think you also want to remove the <!DOCTYPE html> as well, > since > this template will get embedded into alayout which will take care of > all that stuff. > > John > > > Andrew> I think what you're after is something like this to tell the > browser you want to POST: > Andrew> <form action="http://localhost:3000/user" method="POST"> > > Andrew> Does that do the trick? > > Andrew> A > > Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < > gatorreina@gmail.com> wrote: > > Andrew> Wait, Does this provide a clue to the error of my ways? > This is the template (user.tt) that I > Andrew> am using for the form. > > Andrew> <!DOCTYPE html> > Andrew> <html> > Andrew> <body> > > Andrew> <h1>Get in the game.</h1> > > Andrew> <form> > Andrew> First name:<br> > Andrew> <input type="text" name="firstname"> > Andrew> <br> > Andrew> Last name:<br> > Andrew> <input type="text" name="lastname"> > Andrew> <br> > Andrew> Email Address:<br> > Andrew> <input type="text" name="email"> > Andrew> <br> > Andrew> User Password:<br> > Andrew> <input type="password" name="psw"> > Andrew> <br> > Andrew> User Confirm Password:<br> > Andrew> <input type="password" name="psw2"> > Andrew> <br> > Andrew> Terms & Conditions > Andrew> <input type="checkbox" name="terms"> I agree with terms > and conditions.<br> > Andrew> <br> > Andrew> <input type="submit" value="Go" /> > Andrew> </form> > > Andrew> <p>Note that the form itself is not visible.</p> > > Andrew> <p>Also note that the default width of a text field is > 20 characters.</p> > > Andrew> </body> > Andrew> </html> > > Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org > >: > > Andrew> You need to build a web page with a FORM first, then > submit the data > Andrew> that way to the /user URL, so it can get handled. > > Andrew> Try using git to clone this repository and use that > as a base for your > Andrew> playing around: > > Andrew> > https://github.com/agordon/dancer_bootstrap_fontawesome_template.git > > Andrew> I don't have any working examples handy right this > second... > > Richard> I am hoping someone can help me understand how to get this > to > Richard> work as a POST instead of GET. When I do sub below as 'get' > Richard> it works but when I replace 'get' with 'post' I get: > > Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user > Richard> Connecting to 0.0.0.0:3000... connected. > Richard> HTTP request sent, awaiting response... 404 Not Found > Richard> 2015-08-06 13:52:05 ERROR 404: Not Found. > > Richard> package MyApp; > Richard> use Dancer ':syntax'; > Richard> use Dancer::Plugin::FormValidator; > > Richard> our $VERSION = '0.1'; > > Richard> post '/user' => sub { > > Richard> my $input_hash = { > > Richard> FName => param('firstname'), > Richard> LName => param('lastname'), > Richard> Email => param('email'), > Richard> Terms => param('terms'), > > Richard> }; > > Richard> my $number_of_defined_values = scalar grep { defined } > values %{$input_hash}; > Richard> $number_of_defined_values = $number_of_defined_values + > 0; > > Richard> if ($number_of_defined_values > 1) { > > Richard> my $error = form_validator_error( 'profile_user', > $input_hash ); > > Richard> if ( ! $error ) { > Richard> #the user provided complete and validates data > it's cool to proceed > > Richard> } else { > > Richard> my %hash = %$error; > Richard> foreach my $k (keys %hash) { > Richard> return "$k: $hash{$k}\n"; > > Richard> } > > Richard> } > Richard> } > > Richard> template 'user'; > > Richard> ########################################################## > Richard> }; ### end of sub user ################################### > > Richard> true; > > Richard> Thanks in advance for any help. > > Richard> _______________________________________________ > Richard> dancer-users mailing list > Richard> dancer-users@dancer.pm > Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > Andrew> _______________________________________________ > Andrew> dancer-users mailing list > Andrew> dancer-users@dancer.pm > Andrew> > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > > Andrew> _______________________________________________ > Andrew> dancer-users mailing list > Andrew> dancer-users@dancer.pm > Andrew> > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > > Andrew> -- > Andrew> Andrew Solomon > > Andrew> Mentor@Geekuni http://geekuni.com/ > Andrew> http://www.linkedin.com/in/asolomon > > Andrew> _______________________________________________ > Andrew> dancer-users mailing list > Andrew> dancer-users@dancer.pm > Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > _______________________________________________ > dancer-users mailing list > dancer-users@dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
You still need to have a GET route to display the form: get '/user' => sub { template 'user'; } Then when you submit the form it will go to your POST route handler. On Fri, Aug 7, 2015 at 1:59 PM, Richard Reina <gatorreina@gmail.com> wrote:
I can't get the page to appear in the browser so I can't press the Go button.
I get:
Error 404 Page Not Found
Sorry, this is the void. Powered by Dancer <http://perldancer.org/>.
This is user.tt
<!DOCTYPE html> <html> <body>
<h1>Get in the game.</h1>
<form action="user" method="post"> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form>
<p>Note that the form itself is not visible.</p>
<p>Also note that the default width of a text field is 20 characters.</p>
</body> </html>
2015-08-07 12:38 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Richard,
Would you please copy template 'user' here? If everything is OK, when you click on "Go" button, POST requests will be performed
On Fri, Aug 7, 2015 at 8:30 PM, Richard Reina <gatorreina@gmail.com> wrote:
Yes and just did and tried again to make sure.
2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Hi Richard,
Did you restart server after you changed GET with POST at form definition?
On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com> wrote:
Sorry this is my dancer console output:
> Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 > Dancer::Plugin::FormValidator (1.131620) == Entering the development dance floor ... [24745] core @0.000165> request: GET /user from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181
2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
This is my dancer console output.
2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
> replacing the first few lines with: > > <html> > <body> > > <h1>Get in the game.</h1> > > <form action="user" method="POST"> > First name:<br> > > I still get Error 404 > > Interestingly enough when I modify this > http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit > to method="POST" it does not work either. > > 2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>: > >> >> And I know there's a helper you can use to fill in the action so >> that >> you don't have to update the URLs when you deploy it elsewhere.... >> but >> I'm at work and not near my notes... >> >> Ah... here it is. Just do: >> >> <form action="user"> >> >> And I think you also want to remove the <!DOCTYPE html> as well, >> since >> this template will get embedded into alayout which will take care of >> all that stuff. >> >> John >> >> >> Andrew> I think what you're after is something like this to tell >> the browser you want to POST: >> Andrew> <form action="http://localhost:3000/user" method="POST"> >> >> Andrew> Does that do the trick? >> >> Andrew> A >> >> Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < >> gatorreina@gmail.com> wrote: >> >> Andrew> Wait, Does this provide a clue to the error of my ways? >> This is the template (user.tt) that I >> Andrew> am using for the form. >> >> Andrew> <!DOCTYPE html> >> Andrew> <html> >> Andrew> <body> >> >> Andrew> <h1>Get in the game.</h1> >> >> Andrew> <form> >> Andrew> First name:<br> >> Andrew> <input type="text" name="firstname"> >> Andrew> <br> >> Andrew> Last name:<br> >> Andrew> <input type="text" name="lastname"> >> Andrew> <br> >> Andrew> Email Address:<br> >> Andrew> <input type="text" name="email"> >> Andrew> <br> >> Andrew> User Password:<br> >> Andrew> <input type="password" name="psw"> >> Andrew> <br> >> Andrew> User Confirm Password:<br> >> Andrew> <input type="password" name="psw2"> >> Andrew> <br> >> Andrew> Terms & Conditions >> Andrew> <input type="checkbox" name="terms"> I agree with terms >> and conditions.<br> >> Andrew> <br> >> Andrew> <input type="submit" value="Go" /> >> Andrew> </form> >> >> Andrew> <p>Note that the form itself is not visible.</p> >> >> Andrew> <p>Also note that the default width of a text field is >> 20 characters.</p> >> >> Andrew> </body> >> Andrew> </html> >> >> Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel < >> john@stoffel.org>: >> >> Andrew> You need to build a web page with a FORM first, >> then submit the data >> Andrew> that way to the /user URL, so it can get handled. >> >> Andrew> Try using git to clone this repository and use that >> as a base for your >> Andrew> playing around: >> >> Andrew> >> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git >> >> Andrew> I don't have any working examples handy right this >> second... >> >> Richard> I am hoping someone can help me understand how to get this >> to >> Richard> work as a POST instead of GET. When I do sub below as >> 'get' >> Richard> it works but when I replace 'get' with 'post' I get: >> >> Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user >> Richard> Connecting to 0.0.0.0:3000... connected. >> Richard> HTTP request sent, awaiting response... 404 Not Found >> Richard> 2015-08-06 13:52:05 ERROR 404: Not Found. >> >> Richard> package MyApp; >> Richard> use Dancer ':syntax'; >> Richard> use Dancer::Plugin::FormValidator; >> >> Richard> our $VERSION = '0.1'; >> >> Richard> post '/user' => sub { >> >> Richard> my $input_hash = { >> >> Richard> FName => param('firstname'), >> Richard> LName => param('lastname'), >> Richard> Email => param('email'), >> Richard> Terms => param('terms'), >> >> Richard> }; >> >> Richard> my $number_of_defined_values = scalar grep { defined } >> values %{$input_hash}; >> Richard> $number_of_defined_values = $number_of_defined_values >> + 0; >> >> Richard> if ($number_of_defined_values > 1) { >> >> Richard> my $error = form_validator_error( >> 'profile_user', $input_hash ); >> >> Richard> if ( ! $error ) { >> Richard> #the user provided complete and validates >> data it's cool to proceed >> >> Richard> } else { >> >> Richard> my %hash = %$error; >> Richard> foreach my $k (keys %hash) { >> Richard> return "$k: $hash{$k}\n"; >> >> Richard> } >> >> Richard> } >> Richard> } >> >> Richard> template 'user'; >> >> Richard> ########################################################## >> Richard> }; ### end of sub user ################################### >> >> Richard> true; >> >> Richard> Thanks in advance for any help. >> >> Richard> _______________________________________________ >> Richard> dancer-users mailing list >> Richard> dancer-users@dancer.pm >> Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> Andrew> _______________________________________________ >> Andrew> dancer-users mailing list >> Andrew> dancer-users@dancer.pm >> Andrew> >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> >> Andrew> _______________________________________________ >> Andrew> dancer-users mailing list >> Andrew> dancer-users@dancer.pm >> Andrew> >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> >> Andrew> -- >> Andrew> Andrew Solomon >> >> Andrew> Mentor@Geekuni http://geekuni.com/ >> Andrew> http://www.linkedin.com/in/asolomon >> >> Andrew> _______________________________________________ >> Andrew> dancer-users mailing list >> Andrew> dancer-users@dancer.pm >> Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> _______________________________________________ >> dancer-users mailing list >> dancer-users@dancer.pm >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> > >
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
replacing post with get '/user' in my app does allow me to pull up the page but when I enter information into it and press Go I get: File not found Iceweasel can't find the file at http://0.0.0.0:3000/user. Check the file name for capitalization or other typing errors. Check to see if the file was moved, renamed or deleted. And if I enter incorrect or incomplete information into it I get a similar error which of course prevents me from showing the user necessary error handling like return "Last Name was not entered" etc. 2015-08-07 13:03 GMT-05:00 James Baer <jamesfbaer@gmail.com>:
You still need to have a GET route to display the form:
get '/user' => sub { template 'user'; }
Then when you submit the form it will go to your POST route handler.
On Fri, Aug 7, 2015 at 1:59 PM, Richard Reina <gatorreina@gmail.com> wrote:
I can't get the page to appear in the browser so I can't press the Go button.
I get:
Error 404 Page Not Found
Sorry, this is the void. Powered by Dancer <http://perldancer.org/>.
This is user.tt
<!DOCTYPE html> <html> <body>
<h1>Get in the game.</h1>
<form action="user" method="post"> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form>
<p>Note that the form itself is not visible.</p>
<p>Also note that the default width of a text field is 20 characters.</p>
</body> </html>
2015-08-07 12:38 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Richard,
Would you please copy template 'user' here? If everything is OK, when you click on "Go" button, POST requests will be performed
On Fri, Aug 7, 2015 at 8:30 PM, Richard Reina <gatorreina@gmail.com> wrote:
Yes and just did and tried again to make sure.
2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Hi Richard,
Did you restart server after you changed GET with POST at form definition?
On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com> wrote:
Sorry this is my dancer console output:
>> Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 >> Dancer::Plugin::FormValidator (1.131620) == Entering the development dance floor ... [24745] core @0.000165> request: GET /user from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181
2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
> This is my dancer console output. > > > > 2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>: > >> replacing the first few lines with: >> >> <html> >> <body> >> >> <h1>Get in the game.</h1> >> >> <form action="user" method="POST"> >> First name:<br> >> >> I still get Error 404 >> >> Interestingly enough when I modify this >> http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit >> to method="POST" it does not work either. >> >> 2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>: >> >>> >>> And I know there's a helper you can use to fill in the action so >>> that >>> you don't have to update the URLs when you deploy it elsewhere.... >>> but >>> I'm at work and not near my notes... >>> >>> Ah... here it is. Just do: >>> >>> <form action="user"> >>> >>> And I think you also want to remove the <!DOCTYPE html> as well, >>> since >>> this template will get embedded into alayout which will take care >>> of >>> all that stuff. >>> >>> John >>> >>> >>> Andrew> I think what you're after is something like this to tell >>> the browser you want to POST: >>> Andrew> <form action="http://localhost:3000/user" method="POST"> >>> >>> Andrew> Does that do the trick? >>> >>> Andrew> A >>> >>> Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < >>> gatorreina@gmail.com> wrote: >>> >>> Andrew> Wait, Does this provide a clue to the error of my >>> ways? This is the template (user.tt) that I >>> Andrew> am using for the form. >>> >>> Andrew> <!DOCTYPE html> >>> Andrew> <html> >>> Andrew> <body> >>> >>> Andrew> <h1>Get in the game.</h1> >>> >>> Andrew> <form> >>> Andrew> First name:<br> >>> Andrew> <input type="text" name="firstname"> >>> Andrew> <br> >>> Andrew> Last name:<br> >>> Andrew> <input type="text" name="lastname"> >>> Andrew> <br> >>> Andrew> Email Address:<br> >>> Andrew> <input type="text" name="email"> >>> Andrew> <br> >>> Andrew> User Password:<br> >>> Andrew> <input type="password" name="psw"> >>> Andrew> <br> >>> Andrew> User Confirm Password:<br> >>> Andrew> <input type="password" name="psw2"> >>> Andrew> <br> >>> Andrew> Terms & Conditions >>> Andrew> <input type="checkbox" name="terms"> I agree with >>> terms and conditions.<br> >>> Andrew> <br> >>> Andrew> <input type="submit" value="Go" /> >>> Andrew> </form> >>> >>> Andrew> <p>Note that the form itself is not visible.</p> >>> >>> Andrew> <p>Also note that the default width of a text field is >>> 20 characters.</p> >>> >>> Andrew> </body> >>> Andrew> </html> >>> >>> Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel < >>> john@stoffel.org>: >>> >>> Andrew> You need to build a web page with a FORM first, >>> then submit the data >>> Andrew> that way to the /user URL, so it can get handled. >>> >>> Andrew> Try using git to clone this repository and use >>> that as a base for your >>> Andrew> playing around: >>> >>> Andrew> >>> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git >>> >>> Andrew> I don't have any working examples handy right this >>> second... >>> >>> Richard> I am hoping someone can help me understand how to get >>> this to >>> Richard> work as a POST instead of GET. When I do sub below as >>> 'get' >>> Richard> it works but when I replace 'get' with 'post' I get: >>> >>> Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user >>> Richard> Connecting to 0.0.0.0:3000... connected. >>> Richard> HTTP request sent, awaiting response... 404 Not Found >>> Richard> 2015-08-06 13:52:05 ERROR 404: Not Found. >>> >>> Richard> package MyApp; >>> Richard> use Dancer ':syntax'; >>> Richard> use Dancer::Plugin::FormValidator; >>> >>> Richard> our $VERSION = '0.1'; >>> >>> Richard> post '/user' => sub { >>> >>> Richard> my $input_hash = { >>> >>> Richard> FName => param('firstname'), >>> Richard> LName => param('lastname'), >>> Richard> Email => param('email'), >>> Richard> Terms => param('terms'), >>> >>> Richard> }; >>> >>> Richard> my $number_of_defined_values = scalar grep { defined >>> } values %{$input_hash}; >>> Richard> $number_of_defined_values = $number_of_defined_values >>> + 0; >>> >>> Richard> if ($number_of_defined_values > 1) { >>> >>> Richard> my $error = form_validator_error( >>> 'profile_user', $input_hash ); >>> >>> Richard> if ( ! $error ) { >>> Richard> #the user provided complete and validates >>> data it's cool to proceed >>> >>> Richard> } else { >>> >>> Richard> my %hash = %$error; >>> Richard> foreach my $k (keys %hash) { >>> Richard> return "$k: $hash{$k}\n"; >>> >>> Richard> } >>> >>> Richard> } >>> Richard> } >>> >>> Richard> template 'user'; >>> >>> Richard> ########################################################## >>> Richard> }; ### end of sub user ################################### >>> >>> Richard> true; >>> >>> Richard> Thanks in advance for any help. >>> >>> Richard> _______________________________________________ >>> Richard> dancer-users mailing list >>> Richard> dancer-users@dancer.pm >>> Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> Andrew> _______________________________________________ >>> Andrew> dancer-users mailing list >>> Andrew> dancer-users@dancer.pm >>> Andrew> >>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> >>> Andrew> _______________________________________________ >>> Andrew> dancer-users mailing list >>> Andrew> dancer-users@dancer.pm >>> Andrew> >>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> >>> Andrew> -- >>> Andrew> Andrew Solomon >>> >>> Andrew> Mentor@Geekuni http://geekuni.com/ >>> Andrew> http://www.linkedin.com/in/asolomon >>> >>> Andrew> _______________________________________________ >>> Andrew> dancer-users mailing list >>> Andrew> dancer-users@dancer.pm >>> Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> _______________________________________________ >>> dancer-users mailing list >>> dancer-users@dancer.pm >>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> >> >> >
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Do not replace POST with the GET. To be clear, you need both route definitions. unless you do something like: any ['get', 'post'] => '/user' => sub { }; but you will probably have to add some logic to check the request method so I recommend just having: get '/user' => sub { }; post '/user' => sub { }; On Fri, Aug 7, 2015 at 2:17 PM, Richard Reina <gatorreina@gmail.com> wrote:
replacing post with get '/user' in my app does allow me to pull up the page but when I enter information into it and press Go I get:
File not found
Iceweasel can't find the file at http://0.0.0.0:3000/user.
Check the file name for capitalization or other typing errors. Check to see if the file was moved, renamed or deleted.
And if I enter incorrect or incomplete information into it I get a similar error which of course prevents me from showing the user necessary error handling like return "Last Name was not entered" etc.
2015-08-07 13:03 GMT-05:00 James Baer <jamesfbaer@gmail.com>:
You still need to have a GET route to display the form:
get '/user' => sub { template 'user'; }
Then when you submit the form it will go to your POST route handler.
On Fri, Aug 7, 2015 at 1:59 PM, Richard Reina <gatorreina@gmail.com> wrote:
I can't get the page to appear in the browser so I can't press the Go button.
I get:
Error 404 Page Not Found
Sorry, this is the void. Powered by Dancer <http://perldancer.org/>.
This is user.tt
<!DOCTYPE html> <html> <body>
<h1>Get in the game.</h1>
<form action="user" method="post"> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form>
<p>Note that the form itself is not visible.</p>
<p>Also note that the default width of a text field is 20 characters.</p>
</body> </html>
2015-08-07 12:38 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Richard,
Would you please copy template 'user' here? If everything is OK, when you click on "Go" button, POST requests will be performed
On Fri, Aug 7, 2015 at 8:30 PM, Richard Reina <gatorreina@gmail.com> wrote:
Yes and just did and tried again to make sure.
2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Hi Richard,
Did you restart server after you changed GET with POST at form definition?
On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com> wrote:
> Sorry this is my dancer console output: > > >> Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 > >> Dancer::Plugin::FormValidator (1.131620) > == Entering the development dance floor ... > [24745] core @0.000165> request: GET /user from 127.0.0.1 in > /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 > [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against > /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm > l. 85 > [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against > /^\/player$/ (generated from '/player') in > /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 > [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against > /^\/sponsor$/ (generated from '/sponsor') in > /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 > [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against > /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm > l. 85 > [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against > /^\/player$/ (generated from '/player') in > /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 > [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against > /^\/sponsor$/ (generated from '/sponsor') in > /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 > [24745] core @0.001956> [hit #1]response: 304 in > /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 > [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 > in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 > [24745] core @0.000710> [hit #2]response: 304 in > /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 > > > > 2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>: > >> This is my dancer console output. >> >> >> >> 2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>: >> >>> replacing the first few lines with: >>> >>> <html> >>> <body> >>> >>> <h1>Get in the game.</h1> >>> >>> <form action="user" method="POST"> >>> First name:<br> >>> >>> I still get Error 404 >>> >>> Interestingly enough when I modify this >>> http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit >>> to method="POST" it does not work either. >>> >>> 2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>: >>> >>>> >>>> And I know there's a helper you can use to fill in the action so >>>> that >>>> you don't have to update the URLs when you deploy it >>>> elsewhere.... but >>>> I'm at work and not near my notes... >>>> >>>> Ah... here it is. Just do: >>>> >>>> <form action="user"> >>>> >>>> And I think you also want to remove the <!DOCTYPE html> as well, >>>> since >>>> this template will get embedded into alayout which will take care >>>> of >>>> all that stuff. >>>> >>>> John >>>> >>>> >>>> Andrew> I think what you're after is something like this to tell >>>> the browser you want to POST: >>>> Andrew> <form action="http://localhost:3000/user" method="POST"> >>>> >>>> Andrew> Does that do the trick? >>>> >>>> Andrew> A >>>> >>>> Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < >>>> gatorreina@gmail.com> wrote: >>>> >>>> Andrew> Wait, Does this provide a clue to the error of my >>>> ways? This is the template (user.tt) that I >>>> Andrew> am using for the form. >>>> >>>> Andrew> <!DOCTYPE html> >>>> Andrew> <html> >>>> Andrew> <body> >>>> >>>> Andrew> <h1>Get in the game.</h1> >>>> >>>> Andrew> <form> >>>> Andrew> First name:<br> >>>> Andrew> <input type="text" name="firstname"> >>>> Andrew> <br> >>>> Andrew> Last name:<br> >>>> Andrew> <input type="text" name="lastname"> >>>> Andrew> <br> >>>> Andrew> Email Address:<br> >>>> Andrew> <input type="text" name="email"> >>>> Andrew> <br> >>>> Andrew> User Password:<br> >>>> Andrew> <input type="password" name="psw"> >>>> Andrew> <br> >>>> Andrew> User Confirm Password:<br> >>>> Andrew> <input type="password" name="psw2"> >>>> Andrew> <br> >>>> Andrew> Terms & Conditions >>>> Andrew> <input type="checkbox" name="terms"> I agree with >>>> terms and conditions.<br> >>>> Andrew> <br> >>>> Andrew> <input type="submit" value="Go" /> >>>> Andrew> </form> >>>> >>>> Andrew> <p>Note that the form itself is not visible.</p> >>>> >>>> Andrew> <p>Also note that the default width of a text field >>>> is 20 characters.</p> >>>> >>>> Andrew> </body> >>>> Andrew> </html> >>>> >>>> Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel < >>>> john@stoffel.org>: >>>> >>>> Andrew> You need to build a web page with a FORM first, >>>> then submit the data >>>> Andrew> that way to the /user URL, so it can get handled. >>>> >>>> Andrew> Try using git to clone this repository and use >>>> that as a base for your >>>> Andrew> playing around: >>>> >>>> Andrew> >>>> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git >>>> >>>> Andrew> I don't have any working examples handy right >>>> this second... >>>> >>>> Richard> I am hoping someone can help me understand how to get >>>> this to >>>> Richard> work as a POST instead of GET. When I do sub below as >>>> 'get' >>>> Richard> it works but when I replace 'get' with 'post' I get: >>>> >>>> Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user >>>> Richard> Connecting to 0.0.0.0:3000... connected. >>>> Richard> HTTP request sent, awaiting response... 404 Not Found >>>> Richard> 2015-08-06 13:52:05 ERROR 404: Not Found. >>>> >>>> Richard> package MyApp; >>>> Richard> use Dancer ':syntax'; >>>> Richard> use Dancer::Plugin::FormValidator; >>>> >>>> Richard> our $VERSION = '0.1'; >>>> >>>> Richard> post '/user' => sub { >>>> >>>> Richard> my $input_hash = { >>>> >>>> Richard> FName => param('firstname'), >>>> Richard> LName => param('lastname'), >>>> Richard> Email => param('email'), >>>> Richard> Terms => param('terms'), >>>> >>>> Richard> }; >>>> >>>> Richard> my $number_of_defined_values = scalar grep { defined >>>> } values %{$input_hash}; >>>> Richard> $number_of_defined_values = >>>> $number_of_defined_values + 0; >>>> >>>> Richard> if ($number_of_defined_values > 1) { >>>> >>>> Richard> my $error = form_validator_error( >>>> 'profile_user', $input_hash ); >>>> >>>> Richard> if ( ! $error ) { >>>> Richard> #the user provided complete and validates >>>> data it's cool to proceed >>>> >>>> Richard> } else { >>>> >>>> Richard> my %hash = %$error; >>>> Richard> foreach my $k (keys %hash) { >>>> Richard> return "$k: $hash{$k}\n"; >>>> >>>> Richard> } >>>> >>>> Richard> } >>>> Richard> } >>>> >>>> Richard> template 'user'; >>>> >>>> Richard> >>>> ########################################################## >>>> Richard> }; ### end of sub user >>>> ################################### >>>> >>>> Richard> true; >>>> >>>> Richard> Thanks in advance for any help. >>>> >>>> Richard> _______________________________________________ >>>> Richard> dancer-users mailing list >>>> Richard> dancer-users@dancer.pm >>>> Richard> >>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>> Andrew> _______________________________________________ >>>> Andrew> dancer-users mailing list >>>> Andrew> dancer-users@dancer.pm >>>> Andrew> >>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>> >>>> Andrew> _______________________________________________ >>>> Andrew> dancer-users mailing list >>>> Andrew> dancer-users@dancer.pm >>>> Andrew> >>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>> >>>> Andrew> -- >>>> Andrew> Andrew Solomon >>>> >>>> Andrew> Mentor@Geekuni http://geekuni.com/ >>>> Andrew> http://www.linkedin.com/in/asolomon >>>> >>>> Andrew> _______________________________________________ >>>> Andrew> dancer-users mailing list >>>> Andrew> dancer-users@dancer.pm >>>> Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>> _______________________________________________ >>>> dancer-users mailing list >>>> dancer-users@dancer.pm >>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>> >>> >>> >> > > _______________________________________________ > dancer-users mailing list > dancer-users@dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > >
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Okay, then I will go back to using post '/user' => sub { in my app. Unfortunately it still does not work. Any further help would be greeeeaaaaaaatly appreciated as I don't want to spend my weekend stuck like this. Thanks 2015-08-07 13:22 GMT-05:00 James Baer <jamesfbaer@gmail.com>:
Do not replace POST with the GET. To be clear, you need both route definitions. unless you do something like: any ['get', 'post'] => '/user' => sub { }; but you will probably have to add some logic to check the request method so I recommend just having: get '/user' => sub { }; post '/user' => sub { };
On Fri, Aug 7, 2015 at 2:17 PM, Richard Reina <gatorreina@gmail.com> wrote:
replacing post with get '/user' in my app does allow me to pull up the page but when I enter information into it and press Go I get:
File not found
Iceweasel can't find the file at http://0.0.0.0:3000/user.
Check the file name for capitalization or other typing errors. Check to see if the file was moved, renamed or deleted.
And if I enter incorrect or incomplete information into it I get a similar error which of course prevents me from showing the user necessary error handling like return "Last Name was not entered" etc.
2015-08-07 13:03 GMT-05:00 James Baer <jamesfbaer@gmail.com>:
You still need to have a GET route to display the form:
get '/user' => sub { template 'user'; }
Then when you submit the form it will go to your POST route handler.
On Fri, Aug 7, 2015 at 1:59 PM, Richard Reina <gatorreina@gmail.com> wrote:
I can't get the page to appear in the browser so I can't press the Go button.
I get:
Error 404 Page Not Found
Sorry, this is the void. Powered by Dancer <http://perldancer.org/>.
This is user.tt
<!DOCTYPE html> <html> <body>
<h1>Get in the game.</h1>
<form action="user" method="post"> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form>
<p>Note that the form itself is not visible.</p>
<p>Also note that the default width of a text field is 20 characters.</p>
</body> </html>
2015-08-07 12:38 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Richard,
Would you please copy template 'user' here? If everything is OK, when you click on "Go" button, POST requests will be performed
On Fri, Aug 7, 2015 at 8:30 PM, Richard Reina <gatorreina@gmail.com> wrote:
Yes and just did and tried again to make sure.
2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
> Hi Richard, > > Did you restart server after you changed GET with POST at form > definition? > > > On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com> > wrote: > >> Sorry this is my dancer console output: >> >> >> Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 >> >> Dancer::Plugin::FormValidator (1.131620) >> == Entering the development dance floor ... >> [24745] core @0.000165> request: GET /user from 127.0.0.1 in >> /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 >> [24745] core @0.000569> [hit #1]Trying to match 'GET /user' >> against /^\/$/ (generated from '/') in >> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >> [24745] core @0.000757> [hit #1]Trying to match 'GET /user' >> against /^\/player$/ (generated from '/player') in >> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >> [24745] core @0.000932> [hit #1]Trying to match 'GET /user' >> against /^\/sponsor$/ (generated from '/sponsor') in >> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >> [24745] core @0.001113> [hit #1]Trying to match 'GET /user' >> against /^\/$/ (generated from '/') in >> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >> [24745] core @0.001282> [hit #1]Trying to match 'GET /user' >> against /^\/player$/ (generated from '/player') in >> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >> [24745] core @0.001452> [hit #1]Trying to match 'GET /user' >> against /^\/sponsor$/ (generated from '/sponsor') in >> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >> [24745] core @0.001956> [hit #1]response: 304 in >> /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 >> [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 >> in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 >> [24745] core @0.000710> [hit #2]response: 304 in >> /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 >> >> >> >> 2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>: >> >>> This is my dancer console output. >>> >>> >>> >>> 2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>: >>> >>>> replacing the first few lines with: >>>> >>>> <html> >>>> <body> >>>> >>>> <h1>Get in the game.</h1> >>>> >>>> <form action="user" method="POST"> >>>> First name:<br> >>>> >>>> I still get Error 404 >>>> >>>> Interestingly enough when I modify this >>>> http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit >>>> to method="POST" it does not work either. >>>> >>>> 2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>: >>>> >>>>> >>>>> And I know there's a helper you can use to fill in the action so >>>>> that >>>>> you don't have to update the URLs when you deploy it >>>>> elsewhere.... but >>>>> I'm at work and not near my notes... >>>>> >>>>> Ah... here it is. Just do: >>>>> >>>>> <form action="user"> >>>>> >>>>> And I think you also want to remove the <!DOCTYPE html> as well, >>>>> since >>>>> this template will get embedded into alayout which will take >>>>> care of >>>>> all that stuff. >>>>> >>>>> John >>>>> >>>>> >>>>> Andrew> I think what you're after is something like this to tell >>>>> the browser you want to POST: >>>>> Andrew> <form action="http://localhost:3000/user" method="POST"> >>>>> >>>>> Andrew> Does that do the trick? >>>>> >>>>> Andrew> A >>>>> >>>>> Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < >>>>> gatorreina@gmail.com> wrote: >>>>> >>>>> Andrew> Wait, Does this provide a clue to the error of my >>>>> ways? This is the template (user.tt) that I >>>>> Andrew> am using for the form. >>>>> >>>>> Andrew> <!DOCTYPE html> >>>>> Andrew> <html> >>>>> Andrew> <body> >>>>> >>>>> Andrew> <h1>Get in the game.</h1> >>>>> >>>>> Andrew> <form> >>>>> Andrew> First name:<br> >>>>> Andrew> <input type="text" name="firstname"> >>>>> Andrew> <br> >>>>> Andrew> Last name:<br> >>>>> Andrew> <input type="text" name="lastname"> >>>>> Andrew> <br> >>>>> Andrew> Email Address:<br> >>>>> Andrew> <input type="text" name="email"> >>>>> Andrew> <br> >>>>> Andrew> User Password:<br> >>>>> Andrew> <input type="password" name="psw"> >>>>> Andrew> <br> >>>>> Andrew> User Confirm Password:<br> >>>>> Andrew> <input type="password" name="psw2"> >>>>> Andrew> <br> >>>>> Andrew> Terms & Conditions >>>>> Andrew> <input type="checkbox" name="terms"> I agree with >>>>> terms and conditions.<br> >>>>> Andrew> <br> >>>>> Andrew> <input type="submit" value="Go" /> >>>>> Andrew> </form> >>>>> >>>>> Andrew> <p>Note that the form itself is not visible.</p> >>>>> >>>>> Andrew> <p>Also note that the default width of a text field >>>>> is 20 characters.</p> >>>>> >>>>> Andrew> </body> >>>>> Andrew> </html> >>>>> >>>>> Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel < >>>>> john@stoffel.org>: >>>>> >>>>> Andrew> You need to build a web page with a FORM first, >>>>> then submit the data >>>>> Andrew> that way to the /user URL, so it can get handled. >>>>> >>>>> Andrew> Try using git to clone this repository and use >>>>> that as a base for your >>>>> Andrew> playing around: >>>>> >>>>> Andrew> >>>>> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git >>>>> >>>>> Andrew> I don't have any working examples handy right >>>>> this second... >>>>> >>>>> Richard> I am hoping someone can help me understand how to get >>>>> this to >>>>> Richard> work as a POST instead of GET. When I do sub below as >>>>> 'get' >>>>> Richard> it works but when I replace 'get' with 'post' I get: >>>>> >>>>> Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user >>>>> Richard> Connecting to 0.0.0.0:3000... connected. >>>>> Richard> HTTP request sent, awaiting response... 404 Not Found >>>>> Richard> 2015-08-06 13:52:05 ERROR 404: Not Found. >>>>> >>>>> Richard> package MyApp; >>>>> Richard> use Dancer ':syntax'; >>>>> Richard> use Dancer::Plugin::FormValidator; >>>>> >>>>> Richard> our $VERSION = '0.1'; >>>>> >>>>> Richard> post '/user' => sub { >>>>> >>>>> Richard> my $input_hash = { >>>>> >>>>> Richard> FName => param('firstname'), >>>>> Richard> LName => param('lastname'), >>>>> Richard> Email => param('email'), >>>>> Richard> Terms => param('terms'), >>>>> >>>>> Richard> }; >>>>> >>>>> Richard> my $number_of_defined_values = scalar grep { >>>>> defined } values %{$input_hash}; >>>>> Richard> $number_of_defined_values = >>>>> $number_of_defined_values + 0; >>>>> >>>>> Richard> if ($number_of_defined_values > 1) { >>>>> >>>>> Richard> my $error = form_validator_error( >>>>> 'profile_user', $input_hash ); >>>>> >>>>> Richard> if ( ! $error ) { >>>>> Richard> #the user provided complete and validates >>>>> data it's cool to proceed >>>>> >>>>> Richard> } else { >>>>> >>>>> Richard> my %hash = %$error; >>>>> Richard> foreach my $k (keys %hash) { >>>>> Richard> return "$k: $hash{$k}\n"; >>>>> >>>>> Richard> } >>>>> >>>>> Richard> } >>>>> Richard> } >>>>> >>>>> Richard> template 'user'; >>>>> >>>>> Richard> >>>>> ########################################################## >>>>> Richard> }; ### end of sub user >>>>> ################################### >>>>> >>>>> Richard> true; >>>>> >>>>> Richard> Thanks in advance for any help. >>>>> >>>>> Richard> _______________________________________________ >>>>> Richard> dancer-users mailing list >>>>> Richard> dancer-users@dancer.pm >>>>> Richard> >>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>> Andrew> _______________________________________________ >>>>> Andrew> dancer-users mailing list >>>>> Andrew> dancer-users@dancer.pm >>>>> Andrew> >>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>> >>>>> Andrew> _______________________________________________ >>>>> Andrew> dancer-users mailing list >>>>> Andrew> dancer-users@dancer.pm >>>>> Andrew> >>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>> >>>>> Andrew> -- >>>>> Andrew> Andrew Solomon >>>>> >>>>> Andrew> Mentor@Geekuni http://geekuni.com/ >>>>> Andrew> http://www.linkedin.com/in/asolomon >>>>> >>>>> Andrew> _______________________________________________ >>>>> Andrew> dancer-users mailing list >>>>> Andrew> dancer-users@dancer.pm >>>>> Andrew> >>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>> _______________________________________________ >>>>> dancer-users mailing list >>>>> dancer-users@dancer.pm >>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>> >>>> >>>> >>> >> >> _______________________________________________ >> dancer-users mailing list >> dancer-users@dancer.pm >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> >> > > > -- > > *Kadir BeyazlıComputer Engineer* > *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>* > > _______________________________________________ > dancer-users mailing list > dancer-users@dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > >
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Please post your full dancer code as it is now. On Fri, Aug 7, 2015 at 2:31 PM, Richard Reina <gatorreina@gmail.com> wrote:
Okay, then I will go back to using post '/user' => sub { in my app. Unfortunately it still does not work. Any further help would be greeeeaaaaaaatly appreciated as I don't want to spend my weekend stuck like this.
Thanks
2015-08-07 13:22 GMT-05:00 James Baer <jamesfbaer@gmail.com>:
Do not replace POST with the GET. To be clear, you need both route definitions. unless you do something like: any ['get', 'post'] => '/user' => sub { }; but you will probably have to add some logic to check the request method so I recommend just having: get '/user' => sub { }; post '/user' => sub { };
On Fri, Aug 7, 2015 at 2:17 PM, Richard Reina <gatorreina@gmail.com> wrote:
replacing post with get '/user' in my app does allow me to pull up the page but when I enter information into it and press Go I get:
File not found
Iceweasel can't find the file at http://0.0.0.0:3000/user.
Check the file name for capitalization or other typing errors. Check to see if the file was moved, renamed or deleted.
And if I enter incorrect or incomplete information into it I get a similar error which of course prevents me from showing the user necessary error handling like return "Last Name was not entered" etc.
2015-08-07 13:03 GMT-05:00 James Baer <jamesfbaer@gmail.com>:
You still need to have a GET route to display the form:
get '/user' => sub { template 'user'; }
Then when you submit the form it will go to your POST route handler.
On Fri, Aug 7, 2015 at 1:59 PM, Richard Reina <gatorreina@gmail.com> wrote:
I can't get the page to appear in the browser so I can't press the Go button.
I get:
Error 404 Page Not Found
Sorry, this is the void. Powered by Dancer <http://perldancer.org/>.
This is user.tt
<!DOCTYPE html> <html> <body>
<h1>Get in the game.</h1>
<form action="user" method="post"> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form>
<p>Note that the form itself is not visible.</p>
<p>Also note that the default width of a text field is 20 characters.</p>
</body> </html>
2015-08-07 12:38 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Richard,
Would you please copy template 'user' here? If everything is OK, when you click on "Go" button, POST requests will be performed
On Fri, Aug 7, 2015 at 8:30 PM, Richard Reina <gatorreina@gmail.com> wrote:
> Yes and just did and tried again to make sure. > > 2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>: > >> Hi Richard, >> >> Did you restart server after you changed GET with POST at form >> definition? >> >> >> On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com >> > wrote: >> >>> Sorry this is my dancer console output: >>> >>> >> Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 >>> >> Dancer::Plugin::FormValidator (1.131620) >>> == Entering the development dance floor ... >>> [24745] core @0.000165> request: GET /user from 127.0.0.1 in >>> /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 >>> [24745] core @0.000569> [hit #1]Trying to match 'GET /user' >>> against /^\/$/ (generated from '/') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.000757> [hit #1]Trying to match 'GET /user' >>> against /^\/player$/ (generated from '/player') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.000932> [hit #1]Trying to match 'GET /user' >>> against /^\/sponsor$/ (generated from '/sponsor') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.001113> [hit #1]Trying to match 'GET /user' >>> against /^\/$/ (generated from '/') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.001282> [hit #1]Trying to match 'GET /user' >>> against /^\/player$/ (generated from '/player') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.001452> [hit #1]Trying to match 'GET /user' >>> against /^\/sponsor$/ (generated from '/sponsor') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.001956> [hit #1]response: 304 in >>> /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 >>> [24745] core @0.000174> request: GET /css/error.css from >>> 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 >>> [24745] core @0.000710> [hit #2]response: 304 in >>> /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 >>> >>> >>> >>> 2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>: >>> >>>> This is my dancer console output. >>>> >>>> >>>> >>>> 2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>: >>>> >>>>> replacing the first few lines with: >>>>> >>>>> <html> >>>>> <body> >>>>> >>>>> <h1>Get in the game.</h1> >>>>> >>>>> <form action="user" method="POST"> >>>>> First name:<br> >>>>> >>>>> I still get Error 404 >>>>> >>>>> Interestingly enough when I modify this >>>>> http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit >>>>> to method="POST" it does not work either. >>>>> >>>>> 2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>: >>>>> >>>>>> >>>>>> And I know there's a helper you can use to fill in the action >>>>>> so that >>>>>> you don't have to update the URLs when you deploy it >>>>>> elsewhere.... but >>>>>> I'm at work and not near my notes... >>>>>> >>>>>> Ah... here it is. Just do: >>>>>> >>>>>> <form action="user"> >>>>>> >>>>>> And I think you also want to remove the <!DOCTYPE html> as >>>>>> well, since >>>>>> this template will get embedded into alayout which will take >>>>>> care of >>>>>> all that stuff. >>>>>> >>>>>> John >>>>>> >>>>>> >>>>>> Andrew> I think what you're after is something like this to >>>>>> tell the browser you want to POST: >>>>>> Andrew> <form action="http://localhost:3000/user" >>>>>> method="POST"> >>>>>> >>>>>> Andrew> Does that do the trick? >>>>>> >>>>>> Andrew> A >>>>>> >>>>>> Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < >>>>>> gatorreina@gmail.com> wrote: >>>>>> >>>>>> Andrew> Wait, Does this provide a clue to the error of my >>>>>> ways? This is the template (user.tt) that I >>>>>> Andrew> am using for the form. >>>>>> >>>>>> Andrew> <!DOCTYPE html> >>>>>> Andrew> <html> >>>>>> Andrew> <body> >>>>>> >>>>>> Andrew> <h1>Get in the game.</h1> >>>>>> >>>>>> Andrew> <form> >>>>>> Andrew> First name:<br> >>>>>> Andrew> <input type="text" name="firstname"> >>>>>> Andrew> <br> >>>>>> Andrew> Last name:<br> >>>>>> Andrew> <input type="text" name="lastname"> >>>>>> Andrew> <br> >>>>>> Andrew> Email Address:<br> >>>>>> Andrew> <input type="text" name="email"> >>>>>> Andrew> <br> >>>>>> Andrew> User Password:<br> >>>>>> Andrew> <input type="password" name="psw"> >>>>>> Andrew> <br> >>>>>> Andrew> User Confirm Password:<br> >>>>>> Andrew> <input type="password" name="psw2"> >>>>>> Andrew> <br> >>>>>> Andrew> Terms & Conditions >>>>>> Andrew> <input type="checkbox" name="terms"> I agree with >>>>>> terms and conditions.<br> >>>>>> Andrew> <br> >>>>>> Andrew> <input type="submit" value="Go" /> >>>>>> Andrew> </form> >>>>>> >>>>>> Andrew> <p>Note that the form itself is not visible.</p> >>>>>> >>>>>> Andrew> <p>Also note that the default width of a text field >>>>>> is 20 characters.</p> >>>>>> >>>>>> Andrew> </body> >>>>>> Andrew> </html> >>>>>> >>>>>> Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel < >>>>>> john@stoffel.org>: >>>>>> >>>>>> Andrew> You need to build a web page with a FORM first, >>>>>> then submit the data >>>>>> Andrew> that way to the /user URL, so it can get >>>>>> handled. >>>>>> >>>>>> Andrew> Try using git to clone this repository and use >>>>>> that as a base for your >>>>>> Andrew> playing around: >>>>>> >>>>>> Andrew> >>>>>> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git >>>>>> >>>>>> Andrew> I don't have any working examples handy right >>>>>> this second... >>>>>> >>>>>> Richard> I am hoping someone can help me understand how to get >>>>>> this to >>>>>> Richard> work as a POST instead of GET. When I do sub below as >>>>>> 'get' >>>>>> Richard> it works but when I replace 'get' with 'post' I get: >>>>>> >>>>>> Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user >>>>>> Richard> Connecting to 0.0.0.0:3000... connected. >>>>>> Richard> HTTP request sent, awaiting response... 404 Not Found >>>>>> Richard> 2015-08-06 13:52:05 ERROR 404: Not Found. >>>>>> >>>>>> Richard> package MyApp; >>>>>> Richard> use Dancer ':syntax'; >>>>>> Richard> use Dancer::Plugin::FormValidator; >>>>>> >>>>>> Richard> our $VERSION = '0.1'; >>>>>> >>>>>> Richard> post '/user' => sub { >>>>>> >>>>>> Richard> my $input_hash = { >>>>>> >>>>>> Richard> FName => param('firstname'), >>>>>> Richard> LName => param('lastname'), >>>>>> Richard> Email => param('email'), >>>>>> Richard> Terms => param('terms'), >>>>>> >>>>>> Richard> }; >>>>>> >>>>>> Richard> my $number_of_defined_values = scalar grep { >>>>>> defined } values %{$input_hash}; >>>>>> Richard> $number_of_defined_values = >>>>>> $number_of_defined_values + 0; >>>>>> >>>>>> Richard> if ($number_of_defined_values > 1) { >>>>>> >>>>>> Richard> my $error = form_validator_error( >>>>>> 'profile_user', $input_hash ); >>>>>> >>>>>> Richard> if ( ! $error ) { >>>>>> Richard> #the user provided complete and validates >>>>>> data it's cool to proceed >>>>>> >>>>>> Richard> } else { >>>>>> >>>>>> Richard> my %hash = %$error; >>>>>> Richard> foreach my $k (keys %hash) { >>>>>> Richard> return "$k: $hash{$k}\n"; >>>>>> >>>>>> Richard> } >>>>>> >>>>>> Richard> } >>>>>> Richard> } >>>>>> >>>>>> Richard> template 'user'; >>>>>> >>>>>> Richard> >>>>>> ########################################################## >>>>>> Richard> }; ### end of sub user >>>>>> ################################### >>>>>> >>>>>> Richard> true; >>>>>> >>>>>> Richard> Thanks in advance for any help. >>>>>> >>>>>> Richard> _______________________________________________ >>>>>> Richard> dancer-users mailing list >>>>>> Richard> dancer-users@dancer.pm >>>>>> Richard> >>>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>>> Andrew> _______________________________________________ >>>>>> Andrew> dancer-users mailing list >>>>>> Andrew> dancer-users@dancer.pm >>>>>> Andrew> >>>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>>> >>>>>> Andrew> _______________________________________________ >>>>>> Andrew> dancer-users mailing list >>>>>> Andrew> dancer-users@dancer.pm >>>>>> Andrew> >>>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>>> >>>>>> Andrew> -- >>>>>> Andrew> Andrew Solomon >>>>>> >>>>>> Andrew> Mentor@Geekuni http://geekuni.com/ >>>>>> Andrew> http://www.linkedin.com/in/asolomon >>>>>> >>>>>> Andrew> _______________________________________________ >>>>>> Andrew> dancer-users mailing list >>>>>> Andrew> dancer-users@dancer.pm >>>>>> Andrew> >>>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>>> _______________________________________________ >>>>>> dancer-users mailing list >>>>>> dancer-users@dancer.pm >>>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>>> >>>>> >>>>> >>>> >>> >>> _______________________________________________ >>> dancer-users mailing list >>> dancer-users@dancer.pm >>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> >>> >> >> >> -- >> >> *Kadir BeyazlıComputer Engineer* >> *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>* >> >> _______________________________________________ >> dancer-users mailing list >> dancer-users@dancer.pm >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> >> > > _______________________________________________ > dancer-users mailing list > dancer-users@dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > >
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
This is yout template, am i right? <form action="user" method="post"> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form> And this is your code, am i right? post '/user' => sub { .... } On Fri, Aug 7, 2015 at 9:31 PM, Richard Reina <gatorreina@gmail.com> wrote:
Okay, then I will go back to using post '/user' => sub { in my app. Unfortunately it still does not work. Any further help would be greeeeaaaaaaatly appreciated as I don't want to spend my weekend stuck like this.
Thanks
2015-08-07 13:22 GMT-05:00 James Baer <jamesfbaer@gmail.com>:
Do not replace POST with the GET. To be clear, you need both route definitions. unless you do something like: any ['get', 'post'] => '/user' => sub { }; but you will probably have to add some logic to check the request method so I recommend just having: get '/user' => sub { }; post '/user' => sub { };
On Fri, Aug 7, 2015 at 2:17 PM, Richard Reina <gatorreina@gmail.com> wrote:
replacing post with get '/user' in my app does allow me to pull up the page but when I enter information into it and press Go I get:
File not found
Iceweasel can't find the file at http://0.0.0.0:3000/user.
Check the file name for capitalization or other typing errors. Check to see if the file was moved, renamed or deleted.
And if I enter incorrect or incomplete information into it I get a similar error which of course prevents me from showing the user necessary error handling like return "Last Name was not entered" etc.
2015-08-07 13:03 GMT-05:00 James Baer <jamesfbaer@gmail.com>:
You still need to have a GET route to display the form:
get '/user' => sub { template 'user'; }
Then when you submit the form it will go to your POST route handler.
On Fri, Aug 7, 2015 at 1:59 PM, Richard Reina <gatorreina@gmail.com> wrote:
I can't get the page to appear in the browser so I can't press the Go button.
I get:
Error 404 Page Not Found
Sorry, this is the void. Powered by Dancer <http://perldancer.org/>.
This is user.tt
<!DOCTYPE html> <html> <body>
<h1>Get in the game.</h1>
<form action="user" method="post"> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form>
<p>Note that the form itself is not visible.</p>
<p>Also note that the default width of a text field is 20 characters.</p>
</body> </html>
2015-08-07 12:38 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Richard,
Would you please copy template 'user' here? If everything is OK, when you click on "Go" button, POST requests will be performed
On Fri, Aug 7, 2015 at 8:30 PM, Richard Reina <gatorreina@gmail.com> wrote:
> Yes and just did and tried again to make sure. > > 2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>: > >> Hi Richard, >> >> Did you restart server after you changed GET with POST at form >> definition? >> >> >> On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com >> > wrote: >> >>> Sorry this is my dancer console output: >>> >>> >> Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 >>> >> Dancer::Plugin::FormValidator (1.131620) >>> == Entering the development dance floor ... >>> [24745] core @0.000165> request: GET /user from 127.0.0.1 in >>> /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 >>> [24745] core @0.000569> [hit #1]Trying to match 'GET /user' >>> against /^\/$/ (generated from '/') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.000757> [hit #1]Trying to match 'GET /user' >>> against /^\/player$/ (generated from '/player') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.000932> [hit #1]Trying to match 'GET /user' >>> against /^\/sponsor$/ (generated from '/sponsor') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.001113> [hit #1]Trying to match 'GET /user' >>> against /^\/$/ (generated from '/') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.001282> [hit #1]Trying to match 'GET /user' >>> against /^\/player$/ (generated from '/player') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.001452> [hit #1]Trying to match 'GET /user' >>> against /^\/sponsor$/ (generated from '/sponsor') in >>> /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 >>> [24745] core @0.001956> [hit #1]response: 304 in >>> /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 >>> [24745] core @0.000174> request: GET /css/error.css from >>> 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 >>> [24745] core @0.000710> [hit #2]response: 304 in >>> /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 >>> >>> >>> >>> 2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>: >>> >>>> This is my dancer console output. >>>> >>>> >>>> >>>> 2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>: >>>> >>>>> replacing the first few lines with: >>>>> >>>>> <html> >>>>> <body> >>>>> >>>>> <h1>Get in the game.</h1> >>>>> >>>>> <form action="user" method="POST"> >>>>> First name:<br> >>>>> >>>>> I still get Error 404 >>>>> >>>>> Interestingly enough when I modify this >>>>> http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit >>>>> to method="POST" it does not work either. >>>>> >>>>> 2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>: >>>>> >>>>>> >>>>>> And I know there's a helper you can use to fill in the action >>>>>> so that >>>>>> you don't have to update the URLs when you deploy it >>>>>> elsewhere.... but >>>>>> I'm at work and not near my notes... >>>>>> >>>>>> Ah... here it is. Just do: >>>>>> >>>>>> <form action="user"> >>>>>> >>>>>> And I think you also want to remove the <!DOCTYPE html> as >>>>>> well, since >>>>>> this template will get embedded into alayout which will take >>>>>> care of >>>>>> all that stuff. >>>>>> >>>>>> John >>>>>> >>>>>> >>>>>> Andrew> I think what you're after is something like this to >>>>>> tell the browser you want to POST: >>>>>> Andrew> <form action="http://localhost:3000/user" >>>>>> method="POST"> >>>>>> >>>>>> Andrew> Does that do the trick? >>>>>> >>>>>> Andrew> A >>>>>> >>>>>> Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < >>>>>> gatorreina@gmail.com> wrote: >>>>>> >>>>>> Andrew> Wait, Does this provide a clue to the error of my >>>>>> ways? This is the template (user.tt) that I >>>>>> Andrew> am using for the form. >>>>>> >>>>>> Andrew> <!DOCTYPE html> >>>>>> Andrew> <html> >>>>>> Andrew> <body> >>>>>> >>>>>> Andrew> <h1>Get in the game.</h1> >>>>>> >>>>>> Andrew> <form> >>>>>> Andrew> First name:<br> >>>>>> Andrew> <input type="text" name="firstname"> >>>>>> Andrew> <br> >>>>>> Andrew> Last name:<br> >>>>>> Andrew> <input type="text" name="lastname"> >>>>>> Andrew> <br> >>>>>> Andrew> Email Address:<br> >>>>>> Andrew> <input type="text" name="email"> >>>>>> Andrew> <br> >>>>>> Andrew> User Password:<br> >>>>>> Andrew> <input type="password" name="psw"> >>>>>> Andrew> <br> >>>>>> Andrew> User Confirm Password:<br> >>>>>> Andrew> <input type="password" name="psw2"> >>>>>> Andrew> <br> >>>>>> Andrew> Terms & Conditions >>>>>> Andrew> <input type="checkbox" name="terms"> I agree with >>>>>> terms and conditions.<br> >>>>>> Andrew> <br> >>>>>> Andrew> <input type="submit" value="Go" /> >>>>>> Andrew> </form> >>>>>> >>>>>> Andrew> <p>Note that the form itself is not visible.</p> >>>>>> >>>>>> Andrew> <p>Also note that the default width of a text field >>>>>> is 20 characters.</p> >>>>>> >>>>>> Andrew> </body> >>>>>> Andrew> </html> >>>>>> >>>>>> Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel < >>>>>> john@stoffel.org>: >>>>>> >>>>>> Andrew> You need to build a web page with a FORM first, >>>>>> then submit the data >>>>>> Andrew> that way to the /user URL, so it can get >>>>>> handled. >>>>>> >>>>>> Andrew> Try using git to clone this repository and use >>>>>> that as a base for your >>>>>> Andrew> playing around: >>>>>> >>>>>> Andrew> >>>>>> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git >>>>>> >>>>>> Andrew> I don't have any working examples handy right >>>>>> this second... >>>>>> >>>>>> Richard> I am hoping someone can help me understand how to get >>>>>> this to >>>>>> Richard> work as a POST instead of GET. When I do sub below as >>>>>> 'get' >>>>>> Richard> it works but when I replace 'get' with 'post' I get: >>>>>> >>>>>> Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user >>>>>> Richard> Connecting to 0.0.0.0:3000... connected. >>>>>> Richard> HTTP request sent, awaiting response... 404 Not Found >>>>>> Richard> 2015-08-06 13:52:05 ERROR 404: Not Found. >>>>>> >>>>>> Richard> package MyApp; >>>>>> Richard> use Dancer ':syntax'; >>>>>> Richard> use Dancer::Plugin::FormValidator; >>>>>> >>>>>> Richard> our $VERSION = '0.1'; >>>>>> >>>>>> Richard> post '/user' => sub { >>>>>> >>>>>> Richard> my $input_hash = { >>>>>> >>>>>> Richard> FName => param('firstname'), >>>>>> Richard> LName => param('lastname'), >>>>>> Richard> Email => param('email'), >>>>>> Richard> Terms => param('terms'), >>>>>> >>>>>> Richard> }; >>>>>> >>>>>> Richard> my $number_of_defined_values = scalar grep { >>>>>> defined } values %{$input_hash}; >>>>>> Richard> $number_of_defined_values = >>>>>> $number_of_defined_values + 0; >>>>>> >>>>>> Richard> if ($number_of_defined_values > 1) { >>>>>> >>>>>> Richard> my $error = form_validator_error( >>>>>> 'profile_user', $input_hash ); >>>>>> >>>>>> Richard> if ( ! $error ) { >>>>>> Richard> #the user provided complete and validates >>>>>> data it's cool to proceed >>>>>> >>>>>> Richard> } else { >>>>>> >>>>>> Richard> my %hash = %$error; >>>>>> Richard> foreach my $k (keys %hash) { >>>>>> Richard> return "$k: $hash{$k}\n"; >>>>>> >>>>>> Richard> } >>>>>> >>>>>> Richard> } >>>>>> Richard> } >>>>>> >>>>>> Richard> template 'user'; >>>>>> >>>>>> Richard> >>>>>> ########################################################## >>>>>> Richard> }; ### end of sub user >>>>>> ################################### >>>>>> >>>>>> Richard> true; >>>>>> >>>>>> Richard> Thanks in advance for any help. >>>>>> >>>>>> Richard> _______________________________________________ >>>>>> Richard> dancer-users mailing list >>>>>> Richard> dancer-users@dancer.pm >>>>>> Richard> >>>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>>> Andrew> _______________________________________________ >>>>>> Andrew> dancer-users mailing list >>>>>> Andrew> dancer-users@dancer.pm >>>>>> Andrew> >>>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>>> >>>>>> Andrew> _______________________________________________ >>>>>> Andrew> dancer-users mailing list >>>>>> Andrew> dancer-users@dancer.pm >>>>>> Andrew> >>>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>>> >>>>>> Andrew> -- >>>>>> Andrew> Andrew Solomon >>>>>> >>>>>> Andrew> Mentor@Geekuni http://geekuni.com/ >>>>>> Andrew> http://www.linkedin.com/in/asolomon >>>>>> >>>>>> Andrew> _______________________________________________ >>>>>> Andrew> dancer-users mailing list >>>>>> Andrew> dancer-users@dancer.pm >>>>>> Andrew> >>>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>>> _______________________________________________ >>>>>> dancer-users mailing list >>>>>> dancer-users@dancer.pm >>>>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>>>>> >>>>> >>>>> >>>> >>> >>> _______________________________________________ >>> dancer-users mailing list >>> dancer-users@dancer.pm >>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> >>> >> >> >> -- >> >> *Kadir BeyazlıComputer Engineer* >> *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>* >> >> _______________________________________________ >> dancer-users mailing list >> dancer-users@dancer.pm >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> >> > > _______________________________________________ > dancer-users mailing list > dancer-users@dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > >
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- *Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00*
How do you make request? How do you try it? If you write address to browser, GET request is performed. All curl commands are not POST, for POST you should use as follow; curl --data '' http://0.0.0.0:3000/user On Fri, Aug 7, 2015 at 8:59 PM, Richard Reina <gatorreina@gmail.com> wrote:
I can't get the page to appear in the browser so I can't press the Go button.
I get:
Error 404 Page Not Found
Sorry, this is the void. Powered by Dancer <http://perldancer.org/>.
This is user.tt
<!DOCTYPE html> <html> <body>
<h1>Get in the game.</h1>
<form action="user" method="post"> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form>
<p>Note that the form itself is not visible.</p>
<p>Also note that the default width of a text field is 20 characters.</p>
</body> </html>
2015-08-07 12:38 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Richard,
Would you please copy template 'user' here? If everything is OK, when you click on "Go" button, POST requests will be performed
On Fri, Aug 7, 2015 at 8:30 PM, Richard Reina <gatorreina@gmail.com> wrote:
Yes and just did and tried again to make sure.
2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Hi Richard,
Did you restart server after you changed GET with POST at form definition?
On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com> wrote:
Sorry this is my dancer console output:
> Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 > Dancer::Plugin::FormValidator (1.131620) == Entering the development dance floor ... [24745] core @0.000165> request: GET /user from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181
2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
This is my dancer console output.
2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
> replacing the first few lines with: > > <html> > <body> > > <h1>Get in the game.</h1> > > <form action="user" method="POST"> > First name:<br> > > I still get Error 404 > > Interestingly enough when I modify this > http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit > to method="POST" it does not work either. > > 2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>: > >> >> And I know there's a helper you can use to fill in the action so >> that >> you don't have to update the URLs when you deploy it elsewhere.... >> but >> I'm at work and not near my notes... >> >> Ah... here it is. Just do: >> >> <form action="user"> >> >> And I think you also want to remove the <!DOCTYPE html> as well, >> since >> this template will get embedded into alayout which will take care of >> all that stuff. >> >> John >> >> >> Andrew> I think what you're after is something like this to tell >> the browser you want to POST: >> Andrew> <form action="http://localhost:3000/user" method="POST"> >> >> Andrew> Does that do the trick? >> >> Andrew> A >> >> Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < >> gatorreina@gmail.com> wrote: >> >> Andrew> Wait, Does this provide a clue to the error of my ways? >> This is the template (user.tt) that I >> Andrew> am using for the form. >> >> Andrew> <!DOCTYPE html> >> Andrew> <html> >> Andrew> <body> >> >> Andrew> <h1>Get in the game.</h1> >> >> Andrew> <form> >> Andrew> First name:<br> >> Andrew> <input type="text" name="firstname"> >> Andrew> <br> >> Andrew> Last name:<br> >> Andrew> <input type="text" name="lastname"> >> Andrew> <br> >> Andrew> Email Address:<br> >> Andrew> <input type="text" name="email"> >> Andrew> <br> >> Andrew> User Password:<br> >> Andrew> <input type="password" name="psw"> >> Andrew> <br> >> Andrew> User Confirm Password:<br> >> Andrew> <input type="password" name="psw2"> >> Andrew> <br> >> Andrew> Terms & Conditions >> Andrew> <input type="checkbox" name="terms"> I agree with terms >> and conditions.<br> >> Andrew> <br> >> Andrew> <input type="submit" value="Go" /> >> Andrew> </form> >> >> Andrew> <p>Note that the form itself is not visible.</p> >> >> Andrew> <p>Also note that the default width of a text field is >> 20 characters.</p> >> >> Andrew> </body> >> Andrew> </html> >> >> Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel < >> john@stoffel.org>: >> >> Andrew> You need to build a web page with a FORM first, >> then submit the data >> Andrew> that way to the /user URL, so it can get handled. >> >> Andrew> Try using git to clone this repository and use that >> as a base for your >> Andrew> playing around: >> >> Andrew> >> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git >> >> Andrew> I don't have any working examples handy right this >> second... >> >> Richard> I am hoping someone can help me understand how to get this >> to >> Richard> work as a POST instead of GET. When I do sub below as >> 'get' >> Richard> it works but when I replace 'get' with 'post' I get: >> >> Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user >> Richard> Connecting to 0.0.0.0:3000... connected. >> Richard> HTTP request sent, awaiting response... 404 Not Found >> Richard> 2015-08-06 13:52:05 ERROR 404: Not Found. >> >> Richard> package MyApp; >> Richard> use Dancer ':syntax'; >> Richard> use Dancer::Plugin::FormValidator; >> >> Richard> our $VERSION = '0.1'; >> >> Richard> post '/user' => sub { >> >> Richard> my $input_hash = { >> >> Richard> FName => param('firstname'), >> Richard> LName => param('lastname'), >> Richard> Email => param('email'), >> Richard> Terms => param('terms'), >> >> Richard> }; >> >> Richard> my $number_of_defined_values = scalar grep { defined } >> values %{$input_hash}; >> Richard> $number_of_defined_values = $number_of_defined_values >> + 0; >> >> Richard> if ($number_of_defined_values > 1) { >> >> Richard> my $error = form_validator_error( >> 'profile_user', $input_hash ); >> >> Richard> if ( ! $error ) { >> Richard> #the user provided complete and validates >> data it's cool to proceed >> >> Richard> } else { >> >> Richard> my %hash = %$error; >> Richard> foreach my $k (keys %hash) { >> Richard> return "$k: $hash{$k}\n"; >> >> Richard> } >> >> Richard> } >> Richard> } >> >> Richard> template 'user'; >> >> Richard> ########################################################## >> Richard> }; ### end of sub user ################################### >> >> Richard> true; >> >> Richard> Thanks in advance for any help. >> >> Richard> _______________________________________________ >> Richard> dancer-users mailing list >> Richard> dancer-users@dancer.pm >> Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> Andrew> _______________________________________________ >> Andrew> dancer-users mailing list >> Andrew> dancer-users@dancer.pm >> Andrew> >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> >> Andrew> _______________________________________________ >> Andrew> dancer-users mailing list >> Andrew> dancer-users@dancer.pm >> Andrew> >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> >> Andrew> -- >> Andrew> Andrew Solomon >> >> Andrew> Mentor@Geekuni http://geekuni.com/ >> Andrew> http://www.linkedin.com/in/asolomon >> >> Andrew> _______________________________________________ >> Andrew> dancer-users mailing list >> Andrew> dancer-users@dancer.pm >> Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> _______________________________________________ >> dancer-users mailing list >> dancer-users@dancer.pm >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> > >
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- *Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00*
curl --data gives me: curl --data http://0.0.0.0:3000/user curl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more information regardless if I am using get '/user' or post '/user' in my app 2015-08-07 13:05 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
How do you make request? How do you try it? If you write address to browser, GET request is performed. All curl commands are not POST, for POST you should use as follow;
curl --data '' http://0.0.0.0:3000/user
On Fri, Aug 7, 2015 at 8:59 PM, Richard Reina <gatorreina@gmail.com> wrote:
I can't get the page to appear in the browser so I can't press the Go button.
I get:
Error 404 Page Not Found
Sorry, this is the void. Powered by Dancer <http://perldancer.org/>.
This is user.tt
<!DOCTYPE html> <html> <body>
<h1>Get in the game.</h1>
<form action="user" method="post"> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> <br> Email Address:<br> <input type="text" name="email"> <br> User Password:<br> <input type="password" name="psw"> <br> User Confirm Password:<br> <input type="password" name="psw2"> <br> Terms & Conditions <input type="checkbox" name="terms"> I agree with terms and conditions.<br> <br> <input type="submit" value="Go" /> </form>
<p>Note that the form itself is not visible.</p>
<p>Also note that the default width of a text field is 20 characters.</p>
</body> </html>
2015-08-07 12:38 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Richard,
Would you please copy template 'user' here? If everything is OK, when you click on "Go" button, POST requests will be performed
On Fri, Aug 7, 2015 at 8:30 PM, Richard Reina <gatorreina@gmail.com> wrote:
Yes and just did and tried again to make sure.
2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <kadirbeyazli@gmail.com>:
Hi Richard,
Did you restart server after you changed GET with POST at form definition?
On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <gatorreina@gmail.com> wrote:
Sorry this is my dancer console output:
>> Dancer 1.3140 server 24745 listening on http://0.0.0.0:3000 >> Dancer::Plugin::FormValidator (1.131620) == Entering the development dance floor ... [24745] core @0.000165> request: GET /user from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000569> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000757> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.000932> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001113> [hit #1]Trying to match 'GET /user' against /^\/$/ (generated from '/') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001282> [hit #1]Trying to match 'GET /user' against /^\/player$/ (generated from '/player') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001452> [hit #1]Trying to match 'GET /user' against /^\/sponsor$/ (generated from '/sponsor') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 85 [24745] core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181 [24745] core @0.000174> request: GET /css/error.css from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 58 [24745] core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181
2015-08-07 11:58 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
> This is my dancer console output. > > > > 2015-08-07 11:11 GMT-05:00 Richard Reina <gatorreina@gmail.com>: > >> replacing the first few lines with: >> >> <html> >> <body> >> >> <h1>Get in the game.</h1> >> >> <form action="user" method="POST"> >> First name:<br> >> >> I still get Error 404 >> >> Interestingly enough when I modify this >> http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit >> to method="POST" it does not work either. >> >> 2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>: >> >>> >>> And I know there's a helper you can use to fill in the action so >>> that >>> you don't have to update the URLs when you deploy it elsewhere.... >>> but >>> I'm at work and not near my notes... >>> >>> Ah... here it is. Just do: >>> >>> <form action="user"> >>> >>> And I think you also want to remove the <!DOCTYPE html> as well, >>> since >>> this template will get embedded into alayout which will take care >>> of >>> all that stuff. >>> >>> John >>> >>> >>> Andrew> I think what you're after is something like this to tell >>> the browser you want to POST: >>> Andrew> <form action="http://localhost:3000/user" method="POST"> >>> >>> Andrew> Does that do the trick? >>> >>> Andrew> A >>> >>> Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < >>> gatorreina@gmail.com> wrote: >>> >>> Andrew> Wait, Does this provide a clue to the error of my >>> ways? This is the template (user.tt) that I >>> Andrew> am using for the form. >>> >>> Andrew> <!DOCTYPE html> >>> Andrew> <html> >>> Andrew> <body> >>> >>> Andrew> <h1>Get in the game.</h1> >>> >>> Andrew> <form> >>> Andrew> First name:<br> >>> Andrew> <input type="text" name="firstname"> >>> Andrew> <br> >>> Andrew> Last name:<br> >>> Andrew> <input type="text" name="lastname"> >>> Andrew> <br> >>> Andrew> Email Address:<br> >>> Andrew> <input type="text" name="email"> >>> Andrew> <br> >>> Andrew> User Password:<br> >>> Andrew> <input type="password" name="psw"> >>> Andrew> <br> >>> Andrew> User Confirm Password:<br> >>> Andrew> <input type="password" name="psw2"> >>> Andrew> <br> >>> Andrew> Terms & Conditions >>> Andrew> <input type="checkbox" name="terms"> I agree with >>> terms and conditions.<br> >>> Andrew> <br> >>> Andrew> <input type="submit" value="Go" /> >>> Andrew> </form> >>> >>> Andrew> <p>Note that the form itself is not visible.</p> >>> >>> Andrew> <p>Also note that the default width of a text field is >>> 20 characters.</p> >>> >>> Andrew> </body> >>> Andrew> </html> >>> >>> Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel < >>> john@stoffel.org>: >>> >>> Andrew> You need to build a web page with a FORM first, >>> then submit the data >>> Andrew> that way to the /user URL, so it can get handled. >>> >>> Andrew> Try using git to clone this repository and use >>> that as a base for your >>> Andrew> playing around: >>> >>> Andrew> >>> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git >>> >>> Andrew> I don't have any working examples handy right this >>> second... >>> >>> Richard> I am hoping someone can help me understand how to get >>> this to >>> Richard> work as a POST instead of GET. When I do sub below as >>> 'get' >>> Richard> it works but when I replace 'get' with 'post' I get: >>> >>> Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user >>> Richard> Connecting to 0.0.0.0:3000... connected. >>> Richard> HTTP request sent, awaiting response... 404 Not Found >>> Richard> 2015-08-06 13:52:05 ERROR 404: Not Found. >>> >>> Richard> package MyApp; >>> Richard> use Dancer ':syntax'; >>> Richard> use Dancer::Plugin::FormValidator; >>> >>> Richard> our $VERSION = '0.1'; >>> >>> Richard> post '/user' => sub { >>> >>> Richard> my $input_hash = { >>> >>> Richard> FName => param('firstname'), >>> Richard> LName => param('lastname'), >>> Richard> Email => param('email'), >>> Richard> Terms => param('terms'), >>> >>> Richard> }; >>> >>> Richard> my $number_of_defined_values = scalar grep { defined >>> } values %{$input_hash}; >>> Richard> $number_of_defined_values = $number_of_defined_values >>> + 0; >>> >>> Richard> if ($number_of_defined_values > 1) { >>> >>> Richard> my $error = form_validator_error( >>> 'profile_user', $input_hash ); >>> >>> Richard> if ( ! $error ) { >>> Richard> #the user provided complete and validates >>> data it's cool to proceed >>> >>> Richard> } else { >>> >>> Richard> my %hash = %$error; >>> Richard> foreach my $k (keys %hash) { >>> Richard> return "$k: $hash{$k}\n"; >>> >>> Richard> } >>> >>> Richard> } >>> Richard> } >>> >>> Richard> template 'user'; >>> >>> Richard> ########################################################## >>> Richard> }; ### end of sub user ################################### >>> >>> Richard> true; >>> >>> Richard> Thanks in advance for any help. >>> >>> Richard> _______________________________________________ >>> Richard> dancer-users mailing list >>> Richard> dancer-users@dancer.pm >>> Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> Andrew> _______________________________________________ >>> Andrew> dancer-users mailing list >>> Andrew> dancer-users@dancer.pm >>> Andrew> >>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> >>> Andrew> _______________________________________________ >>> Andrew> dancer-users mailing list >>> Andrew> dancer-users@dancer.pm >>> Andrew> >>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> >>> Andrew> -- >>> Andrew> Andrew Solomon >>> >>> Andrew> Mentor@Geekuni http://geekuni.com/ >>> Andrew> http://www.linkedin.com/in/asolomon >>> >>> Andrew> _______________________________________________ >>> Andrew> dancer-users mailing list >>> Andrew> dancer-users@dancer.pm >>> Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> _______________________________________________ >>> dancer-users mailing list >>> dancer-users@dancer.pm >>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >>> >> >> >
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
--
*Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00 <%2B90%20535%20821%2050%2000>*
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew, I think you really need to back up and start from scratch again. Unfortunately I've got family around and can't spend the time to help directly, but what I would do is: 1. start a new dancer project. 2. build a new template for the index page with a <form ....> ... </form> in it with just a single text entry and a submit button. Simple stuff. Make sure the text post has a name of 'query'. 3. You need two routes in your lib/Module.pm file: package Module; use Dancer ':syntax'; use Dancer::Plugin::DBIC; our $VERSION = '0.1'; get '/' => sub { template 'index', { title => "The Index", }; }; get '/search' => sub { my $query = params->{query} || ""; my $regexp = $query; $regexp =~ s/\?|\*/\.\*/g; my $tobold = $query; $tobold =~ s/\?|\*//g; my @results = (); my $limit = 50; if (length $query) { @results = _perform_search($regexp,$limit); } } And of course a subroutine called _perform_search() to do the actual work. Once you have that working, try using the POST method, and adding in the: post '/search2' => sub { } routines. Then you *should* be able ot handle it. I'd also look more closely at the Dancer Advent calendar stuff as well. The advantage of GET calls is that you can more easily wrap them into a div and return results, etc. But honestly I'm an old dog also learning new tricks... :-) John
Okay will start over and try this. I take it I should start over in Dancer2 right? 2015-08-07 15:15 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew,
I think you really need to back up and start from scratch again. Unfortunately I've got family around and can't spend the time to help directly, but what I would do is:
1. start a new dancer project.
2. build a new template for the index page with a <form ....> ... </form> in it with just a single text entry and a submit button. Simple stuff. Make sure the text post has a name of 'query'.
3. You need two routes in your lib/Module.pm file:
package Module; use Dancer ':syntax'; use Dancer::Plugin::DBIC;
our $VERSION = '0.1';
get '/' => sub { template 'index', { title => "The Index", }; };
get '/search' => sub { my $query = params->{query} || ""; my $regexp = $query; $regexp =~ s/\?|\*/\.\*/g; my $tobold = $query; $tobold =~ s/\?|\*//g;
my @results = (); my $limit = 50; if (length $query) { @results = _perform_search($regexp,$limit); } }
And of course a subroutine called _perform_search() to do the actual work.
Once you have that working, try using the POST method, and adding in the:
post '/search2' => sub {
}
routines. Then you *should* be able ot handle it.
I'd also look more closely at the Dancer Advent calendar stuff as well. The advantage of GET calls is that you can more easily wrap them into a div and return results, etc.
But honestly I'm an old dog also learning new tricks... :-)
John _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Dancer2 - definitely. On Fri, Aug 7, 2015 at 9:25 PM, Richard Reina <gatorreina@gmail.com> wrote:
Okay will start over and try this. I take it I should start over in Dancer2 right?
2015-08-07 15:15 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew,
I think you really need to back up and start from scratch again. Unfortunately I've got family around and can't spend the time to help directly, but what I would do is:
1. start a new dancer project.
2. build a new template for the index page with a <form ....> ... </form> in it with just a single text entry and a submit button. Simple stuff. Make sure the text post has a name of 'query'.
3. You need two routes in your lib/Module.pm file:
package Module; use Dancer ':syntax'; use Dancer::Plugin::DBIC;
our $VERSION = '0.1';
get '/' => sub { template 'index', { title => "The Index", }; };
get '/search' => sub { my $query = params->{query} || ""; my $regexp = $query; $regexp =~ s/\?|\*/\.\*/g; my $tobold = $query; $tobold =~ s/\?|\*//g;
my @results = (); my $limit = 50; if (length $query) { @results = _perform_search($regexp,$limit); } }
And of course a subroutine called _perform_search() to do the actual work.
Once you have that working, try using the POST method, and adding in the:
post '/search2' => sub {
}
routines. Then you *should* be able ot handle it.
I'd also look more closely at the Dancer Advent calendar stuff as well. The advantage of GET calls is that you can more easily wrap them into a div and return results, etc.
But honestly I'm an old dog also learning new tricks... :-)
John _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- Andrew Solomon Mentor@Geekuni http://geekuni.com/ http://www.linkedin.com/in/asolomon
Okay started over with Dancer2 -a MyApp and before making any of the recomended modicifcations tested out the app out of the box with richard@gemini:~/Dancer2/MyApp$ plackup -r bin/app.psgi and get this in the browser: <% content %> Powered by Dancer2 <http://perldancer.org/> <% dancer_version %> wget gives me this: richard@gemini:~/Dancer2/MyApp$ wget -O - http://0:5000/ --2015-08-07 16:53:51-- http://0:5000/ Resolving 0 (0)... 0.0.0.0 Connecting to 0 (0)|0.0.0.0|:5000... connected. HTTP request sent, awaiting response... 200 OK Length: 835 [text/html] Saving to: `STDOUT' 0% [ ] 0 --.-K/s <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; charset=<% settings.charset %>" /> <title>MyApp</title> <link rel="stylesheet" href="<% request.uri_base %>/css/style.css" /> <!-- Grab jQuery from a CDN, fall back to local if necessary --> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <script type="text/javascript">/* <![CDATA[ */ !window.jQuery && document.write('<script type="text/javascript" src="<% request.uri_base %>/javascripts/jquery.js"><\/script>') /* ]]> */</script> </head> <body> <% content %> <div id="footer"> Powered by <a href="http://perldancer.org/">Dancer2</a> <% dancer_version %> </div> </body> </html> 100%[========================================================================================>] 835 --.-K/s in 0s 2015-08-07 16:53:51 (5.63 MB/s) - written to stdout [835/835] richard@gemini:~/Dancer2/MyApp$ 2015-08-07 15:47 GMT-05:00 Andrew Solomon <andrew@geekuni.com>:
Dancer2 - definitely.
On Fri, Aug 7, 2015 at 9:25 PM, Richard Reina <gatorreina@gmail.com> wrote:
Okay will start over and try this. I take it I should start over in Dancer2 right?
2015-08-07 15:15 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew,
I think you really need to back up and start from scratch again. Unfortunately I've got family around and can't spend the time to help directly, but what I would do is:
1. start a new dancer project.
2. build a new template for the index page with a <form ....> ... </form> in it with just a single text entry and a submit button. Simple stuff. Make sure the text post has a name of 'query'.
3. You need two routes in your lib/Module.pm file:
package Module; use Dancer ':syntax'; use Dancer::Plugin::DBIC;
our $VERSION = '0.1';
get '/' => sub { template 'index', { title => "The Index", }; };
get '/search' => sub { my $query = params->{query} || ""; my $regexp = $query; $regexp =~ s/\?|\*/\.\*/g; my $tobold = $query; $tobold =~ s/\?|\*//g;
my @results = (); my $limit = 50; if (length $query) { @results = _perform_search($regexp,$limit); } }
And of course a subroutine called _perform_search() to do the actual work.
Once you have that working, try using the POST method, and adding in the:
post '/search2' => sub {
}
routines. Then you *should* be able ot handle it.
I'd also look more closely at the Dancer Advent calendar stuff as well. The advantage of GET calls is that you can more easily wrap them into a div and return results, etc.
But honestly I'm an old dog also learning new tricks... :-)
John _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- Andrew Solomon
Mentor@Geekuni http://geekuni.com/ http://www.linkedin.com/in/asolomon
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
On Aug 7, 2015, at 4:00 PM, Richard Reina <gatorreina@gmail.com> wrote:
get this in the browser:
<% content %> Powered by Dancer2 <% dancer_version %>
It looks like Dancer is not expanding the templates. Are you sure Template::Toolkit installed correctly? Try “sudo cpanm Dancer2”, and see if it installs anything that wasn’t there before.
Is it possible the config is set to use [% and %]? --john On 8/7/2015 5:06 PM, Warren Young wrote:
On Aug 7, 2015, at 4:00 PM, Richard Reina <gatorreina@gmail.com> wrote:
get this in the browser:
<% content %> Powered by Dancer2 <% dancer_version %> It looks like Dancer is not expanding the templates. Are you sure Template::Toolkit installed correctly?
Try “sudo cpanm Dancer2”, and see if it installs anything that wasn’t there before. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Yes, Dancer2 Template Toolkit is installed. Curiosly when I swithc back to simple template in config.yml the basic dancer app works. So I do not understand why it would not if TToolkit is installed. However, when I switch to TToolkit I continue to get this in my browser: <% content %> Powered by Dancer2 <http://perldancer.org/> <% dancer_version %> Here is the output from the console. richard@gemini:~/Dancer2/MyApp$ plackup -r bin/app.psgi Watching bin/lib bin/app.psgi for file updates. HTTP::Server::PSGI: Accepting connections at http://0:5000/ [MyApp:2230] core @2015-08-10 07:47:43> looking for get / in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.app.before_request in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.app.after_request in (eval 78) l. 1 127.0.0.1 - - [10/Aug/2015:07:47:43 -0500] "GET / HTTP/1.1" 200 835 "-" "Mozilla/5.0 (X11; Linux i686; rv:39.0) Gecko/20100101 Firefox/39.0" [MyApp:2230] core @2015-08-10 07:47:43> looking for get /<% request.uri_base %>/css/style.css in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.init in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.before in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.after in (eval 78) l. 1 127.0.0.1 - - [10/Aug/2015:07:47:43 -0500] "GET /%3C%%20request.uri_base%20%%3E/css/style.css HTTP/1.1" 404 522 " http://0:5000/" "Mozilla/5.0 (X11; Linux i686; rv:39.0) Gecko/20100101 Firefox/39.0" [MyApp:2230] core @2015-08-10 07:52:35> looking for get / in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180 [MyApp:2230] core @2015-08-10 07:52:35> Entering hook core.app.before_request in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:52:35> Entering hook core.app.after_request in (eval 78) l. 1 127.0.0.1 - - [10/Aug/2015:07:52:35 -0500] "GET / HTTP/1.1" 200 835 "-" "Wget/1.13.4 (linux-gnu)" Here is my ouput from wget. richard@gemini:~/Dancer2/MyApp$ wget -O - http://0:5000/ --2015-08-10 08:32:23-- http://0:5000/ Resolving 0 (0)... 0.0.0.0 Connecting to 0 (0)|0.0.0.0|:5000... connected. HTTP request sent, awaiting response... 200 OK Length: 835 [text/html] Saving to: `STDOUT' 0% [ ] 0 --.-K/s <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; charset=<% settings.charset %>" /> <title>MyApp</title> <link rel="stylesheet" href="<% request.uri_base %>/css/style.css" /> <!-- Grab jQuery from a CDN, fall back to local if necessary --> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <script type="text/javascript">/* <![CDATA[ */ !window.jQuery && document.write('<script type="text/javascript" src="<% request.uri_base %>/javascripts/jquery.js"><\/script>') /* ]]> */</script> </head> <body> <% content %> <div id="footer"> Powered by <a href="http://perldancer.org/">Dancer2</a> <% dancer_version %> </div> </body> </html> 100%[========================================================================================>] 835 --.-K/s in 0s 2015-08-10 08:32:23 (77.0 MB/s) - written to stdout [835/835] Again, this is just the basic Dancer2 app created with: $: Dancer2 -a MyApp. Here is my config.yml file. # This is the main configuration file of your Dancer2 app # env-related settings should go to environments/$env.yml # all the settings in this file will be loaded at Dancer's startup. # Your application's name appname: "MyApp" # The default layout to use for your application (located in # views/layouts/main.tt) layout: "main" # when the charset is set to UTF-8 Dancer2 will handle for you # all the magic of encoding and decoding. You should not care # about unicode within your app when this setting is set (recommended). charset: "UTF-8" # template engine # simple: default and very basic template engine # template_toolkit: TT #template: "simple" template: "template_toolkit" # engines: # template: # template_toolkit: # start_tag: '<%' # end_tag: '%>' Thanks for any help. 2015-08-07 18:06 GMT-05:00 Warren Young <wyml@etr-usa.com>:
On Aug 7, 2015, at 4:00 PM, Richard Reina <gatorreina@gmail.com> wrote:
get this in the browser:
<% content %> Powered by Dancer2 <% dancer_version %>
It looks like Dancer is not expanding the templates. Are you sure Template::Toolkit installed correctly?
Try “sudo cpanm Dancer2”, and see if it installs anything that wasn’t there before. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
That is because the default delimiters for Template toolkit are [% and %] You have two choices : uncomment the start and end tag definitions in your config to <% and %> template: "template_toolkit" engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' or change the delimeters in views/index.tt and views/layouts/main.tt to use the template toolkit default. i.e. <% to [% and %> to %] Cheers Tony On 10/08/2015 14:33, Richard Reina wrote:
Yes, Dancer2 Template Toolkit is installed. Curiosly when I swithc back to simple template in config.yml the basic dancer app works. So I do not understand why it would not if TToolkit is installed. However, when I switch to TToolkit I continue to get this in my browser:
<% content %> Powered by Dancer2 <http://perldancer.org/> <% dancer_version %>
Here is the output from the console.
richard@gemini:~/Dancer2/MyApp$ plackup -r bin/app.psgi Watching bin/lib bin/app.psgi for file updates. HTTP::Server::PSGI: Accepting connections at http://0:5000/ [MyApp:2230] core @2015-08-10 07:47:43> looking for get / in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.app.before_request in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.app.after_request in (eval 78) l. 1 127.0.0.1 - - [10/Aug/2015:07:47:43 -0500] "GET / HTTP/1.1" 200 835 "-" "Mozilla/5.0 (X11; Linux i686; rv:39.0) Gecko/20100101 Firefox/39.0" [MyApp:2230] core @2015-08-10 07:47:43> looking for get /<% request.uri_base %>/css/style.css in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.init in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.before in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.after in (eval 78) l. 1 127.0.0.1 - - [10/Aug/2015:07:47:43 -0500] "GET /%3C%%20request.uri_base%20%%3E/css/style.css HTTP/1.1" 404 522 "http://0:5000/" "Mozilla/5.0 (X11; Linux i686; rv:39.0) Gecko/20100101 Firefox/39.0" [MyApp:2230] core @2015-08-10 07:52:35> looking for get / in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180 [MyApp:2230] core @2015-08-10 07:52:35> Entering hook core.app.before_request in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:52:35> Entering hook core.app.after_request in (eval 78) l. 1 127.0.0.1 - - [10/Aug/2015:07:52:35 -0500] "GET / HTTP/1.1" 200 835 "-" "Wget/1.13.4 (linux-gnu)"
Here is my ouput from wget.
richard@gemini:~/Dancer2/MyApp$ wget -O - http://0:5000/ --2015-08-10 08:32:23-- http://0:5000/ Resolving 0 (0)... 0.0.0.0 Connecting to 0 (0)|0.0.0.0|:5000... connected. HTTP request sent, awaiting response... 200 OK Length: 835 [text/html] Saving to: `STDOUT'
0% [ ] 0 --.-K/s <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; settings.charset %>" /> <title>MyApp</title> <link rel="stylesheet" href="<% request.uri_base %>/css/style.css" />
<!-- Grab jQuery from a CDN, fall back to local if necessary --> <script src="//code.jquery.com/jquery-1.11.1.min.js <http://code.jquery.com/jquery-1.11.1.min.js>"></script> <script type="text/javascript">/* <![CDATA[ */ !window.jQuery && document.write('<script type="text/javascript" src="<% request.uri_base %>/javascripts/jquery.js"><\/script>') /* ]]> */</script>
</head> <body> <% content %> <div id="footer"> Powered by <a href="http://perldancer.org/">Dancer2</a> <% dancer_version %> </div> </body> </html> 100%[========================================================================================>] 835 --.-K/s in 0s
2015-08-10 08:32:23 (77.0 MB/s) - written to stdout [835/835]
Again, this is just the basic Dancer2 app created with: $: Dancer2 -a MyApp.
Here is my config.yml file.
# This is the main configuration file of your Dancer2 app # env-related settings should go to environments/$env.yml # all the settings in this file will be loaded at Dancer's startup.
# Your application's name appname: "MyApp"
# The default layout to use for your application (located in # views/layouts/main.tt <http://main.tt>) layout: "main"
# when the charset is set to UTF-8 Dancer2 will handle for you # all the magic of encoding and decoding. You should not care # about unicode within your app when this setting is set (recommended). charset: "UTF-8"
# template engine # simple: default and very basic template engine # template_toolkit: TT
#template: "simple"
template: "template_toolkit" # engines: # template: # template_toolkit: # start_tag: '<%' # end_tag: '%>'
Thanks for any help.
2015-08-07 18:06 GMT-05:00 Warren Young <wyml@etr-usa.com <mailto:wyml@etr-usa.com>>:
On Aug 7, 2015, at 4:00 PM, Richard Reina <gatorreina@gmail.com <mailto:gatorreina@gmail.com>> wrote: > > get this in the browser: > > <% content %> > Powered by Dancer2 <% dancer_version %>
It looks like Dancer is not expanding the templates. Are you sure Template::Toolkit installed correctly?
Try “sudo cpanm Dancer2”, and see if it installs anything that wasn’t there before. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm <mailto:dancer-users@dancer.pm> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Sure enough. That did the trick. On to make the changes that John prescribed above. Will let everone know how it goes. Thanks very much. 2015-08-10 8:49 GMT-05:00 Tony Edwardson <tony@edwardson.co.uk>:
That is because the default delimiters for Template toolkit are [% and %] You have two choices : uncomment the start and end tag definitions in your config to <% and %> template: "template_toolkit" engines: template: template_toolkit: start_tag: '<%' end_tag: '%>'
or change the delimeters in views/index.tt and views/layouts/main.tt to use the template toolkit default. i.e. <% to [% and %> to %]
Cheers Tony
On 10/08/2015 14:33, Richard Reina wrote:
Yes, Dancer2 Template Toolkit is installed. Curiosly when I swithc back to simple template in config.yml the basic dancer app works. So I do not understand why it would not if TToolkit is installed. However, when I switch to TToolkit I continue to get this in my browser:
<% content %> Powered by Dancer2 <http://perldancer.org/> <% dancer_version %>
Here is the output from the console.
richard@gemini:~/Dancer2/MyApp$ plackup -r bin/app.psgi Watching bin/lib bin/app.psgi for file updates. HTTP::Server::PSGI: Accepting connections at <http://0:5000/> http://0:5000/ [MyApp:2230] core @2015-08-10 07:47:43> looking for get / in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.app.before_request in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.app.after_request in (eval 78) l. 1 127.0.0.1 - - [10/Aug/2015:07:47:43 -0500] "GET / HTTP/1.1" 200 835 "-" "Mozilla/5.0 (X11; Linux i686; rv:39.0) Gecko/20100101 Firefox/39.0" [MyApp:2230] core @2015-08-10 07:47:43> looking for get /<% request.uri_base %>/css/style.css in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.init in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.before in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.after in (eval 78) l. 1 127.0.0.1 - - [10/Aug/2015:07:47:43 -0500] "GET /%3C%%20request.uri_base%20%%3E/css/style.css HTTP/1.1" 404 522 " http://0:5000/" "Mozilla/5.0 (X11; Linux i686; rv:39.0) Gecko/20100101 Firefox/39.0" [MyApp:2230] core @2015-08-10 07:52:35> looking for get / in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180 [MyApp:2230] core @2015-08-10 07:52:35> Entering hook core.app.before_request in (eval 78) l. 1 [MyApp:2230] core @2015-08-10 07:52:35> Entering hook core.app.after_request in (eval 78) l. 1 127.0.0.1 - - [10/Aug/2015:07:52:35 -0500] "GET / HTTP/1.1" 200 835 "-" "Wget/1.13.4 (linux-gnu)"
Here is my ouput from wget.
richard@gemini:~/Dancer2/MyApp$ wget -O - <http://0:5000/>http://0:5000/ --2015-08-10 08:32:23-- http://0:5000/ Resolving 0 (0)... 0.0.0.0 Connecting to 0 (0)|0.0.0.0|:5000... connected. HTTP request sent, awaiting response... 200 OK Length: 835 [text/html] Saving to: `STDOUT'
0% [ ] 0 --.-K/s <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; settings.charset %>" />
<title>MyApp</title> <link rel="stylesheet" href="<% request.uri_base %>/css/style.css" />
<!-- Grab jQuery from a CDN, fall back to local if necessary --> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <script type="text/javascript">/* <![CDATA[ */ !window.jQuery && document.write('<script type="text/javascript" src="<% request.uri_base %>/javascripts/jquery.js"><\/script>') /* ]]> */</script>
</head> <body> <% content %> <div id="footer"> Powered by <a href="http://perldancer.org/">Dancer2</a> <% dancer_version %> </div> </body> </html> 100%[========================================================================================>] 835 --.-K/s in 0s
2015-08-10 08:32:23 (77.0 MB/s) - written to stdout [835/835]
Again, this is just the basic Dancer2 app created with: $: Dancer2 -a MyApp.
Here is my config.yml file.
# This is the main configuration file of your Dancer2 app # env-related settings should go to environments/$env.yml # all the settings in this file will be loaded at Dancer's startup.
# Your application's name appname: "MyApp"
# The default layout to use for your application (located in # views/layouts/main.tt) layout: "main"
# when the charset is set to UTF-8 Dancer2 will handle for you # all the magic of encoding and decoding. You should not care # about unicode within your app when this setting is set (recommended). charset: "UTF-8"
# template engine # simple: default and very basic template engine # template_toolkit: TT
#template: "simple"
template: "template_toolkit" # engines: # template: # template_toolkit: # start_tag: '<%' # end_tag: '%>'
Thanks for any help.
2015-08-07 18:06 GMT-05:00 Warren Young <wyml@etr-usa.com>:
On Aug 7, 2015, at 4:00 PM, Richard Reina < <gatorreina@gmail.com> gatorreina@gmail.com> wrote:
get this in the browser:
<% content %> Powered by Dancer2 <% dancer_version %>
It looks like Dancer is not expanding the templates. Are you sure Template::Toolkit installed correctly?
Try “sudo cpanm Dancer2”, and see if it installs anything that wasn’t there before. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing listdancer-users@dancer.pmhttp://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Hi John, I couple questions about your sample above: 1) in the simple form what should I put for action=? Here is what I have so far: <form action="index.tt"> Query:<br> <input type="text" name="query" value="Mickey"> <br><br> <input type="submit" value="Submit"> </form> 2) This is what I have for the sub _perform_search sub _perform_search( my $fake_search_results = 'Comcast loves net neutrality"; return $fake_search_results; ) Is this okay? 2015-08-07 15:15 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew,
I think you really need to back up and start from scratch again. Unfortunately I've got family around and can't spend the time to help directly, but what I would do is:
1. start a new dancer project.
2. build a new template for the index page with a <form ....> ... </form> in it with just a single text entry and a submit button. Simple stuff. Make sure the text post has a name of 'query'.
3. You need two routes in your lib/Module.pm file:
package Module; use Dancer ':syntax'; use Dancer::Plugin::DBIC;
our $VERSION = '0.1';
get '/' => sub { template 'index', { title => "The Index", }; };
get '/search' => sub { my $query = params->{query} || ""; my $regexp = $query; $regexp =~ s/\?|\*/\.\*/g; my $tobold = $query; $tobold =~ s/\?|\*//g;
my @results = (); my $limit = 50; if (length $query) { @results = _perform_search($regexp,$limit); } }
And of course a subroutine called _perform_search() to do the actual work.
Once you have that working, try using the POST method, and adding in the:
post '/search2' => sub {
}
routines. Then you *should* be able ot handle it.
I'd also look more closely at the Dancer Advent calendar stuff as well. The advantage of GET calls is that you can more easily wrap them into a div and return results, etc.
But honestly I'm an old dog also learning new tricks... :-)
John _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
I went to this example: http://perlmaven.com/building-a-blog-engine-using-perl-dancer and noticed that he put a get sub then followed by a post sub for the same page. Tried this and it worked and the form no longer puts the submited imput into the url which is my objective for using post. I hope that's okay. 2015-08-10 9:21 GMT-05:00 Richard Reina <gatorreina@gmail.com>:
Hi John,
I couple questions about your sample above:
1) in the simple form what should I put for action=?
Here is what I have so far:
<form action="index.tt"> Query:<br> <input type="text" name="query" value="Mickey"> <br><br> <input type="submit" value="Submit"> </form>
2) This is what I have for the sub _perform_search sub _perform_search(
my $fake_search_results = 'Comcast loves net neutrality"; return $fake_search_results;
)
Is this okay?
2015-08-07 15:15 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew,
I think you really need to back up and start from scratch again. Unfortunately I've got family around and can't spend the time to help directly, but what I would do is:
1. start a new dancer project.
2. build a new template for the index page with a <form ....> ... </form> in it with just a single text entry and a submit button. Simple stuff. Make sure the text post has a name of 'query'.
3. You need two routes in your lib/Module.pm file:
package Module; use Dancer ':syntax'; use Dancer::Plugin::DBIC;
our $VERSION = '0.1';
get '/' => sub { template 'index', { title => "The Index", }; };
get '/search' => sub { my $query = params->{query} || ""; my $regexp = $query; $regexp =~ s/\?|\*/\.\*/g; my $tobold = $query; $tobold =~ s/\?|\*//g;
my @results = (); my $limit = 50; if (length $query) { @results = _perform_search($regexp,$limit); } }
And of course a subroutine called _perform_search() to do the actual work.
Once you have that working, try using the POST method, and adding in the:
post '/search2' => sub {
}
routines. Then you *should* be able ot handle it.
I'd also look more closely at the Dancer Advent calendar stuff as well. The advantage of GET calls is that you can more easily wrap them into a div and return results, etc.
But honestly I'm an old dog also learning new tricks... :-)
John _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
On Aug 10, 2015, at 11:34 AM, Richard Reina <gatorreina@gmail.com> wrote:
noticed that he put a get sub then followed by a post sub for the same page. Tried this and it worked and the form no longer puts the submited imput into the url which is my objective for using post. I hope that's okay.
That’s not only okay, it’s exactly the right way to do it. Think of the HTTP verb (GET, POST, PUT, DELETE...) as part of a sentence, with the URL being the object of that sentence. You need both in order to make sense of the request. The browser says GET. Get what? GET /app/foo/bar. Okay, browser, here is /app/foo/bar. The browser wants us to have some new data. How does it tell us this? With a POST. What is it posting? It is posting the data following the HTTP Content header. Where does it want this new data to be? Under /app/foo/bar. Okay, browser, we accept your new data. These are completely different uses of /app/foo/bar, because the verbs are different. The same is true for the other HTTP verbs. Dancer supports three more, via the del, put, and patch keywords. These would all be different requests as well, even if the URL part remains the same. I recommend that you read up on the REST design paradigm. Route-based web frameworks (Dancer, node.js, etc.) make REST implementation straightforward, as compared to file-based web frameworks (ASP, PHP, Catalyst, etc.)
Richard, Sorry I can't answer your questions right now, I'm on vacation without much access to email. Yay! But the other answers in the thread should get you on the right path. John
No worries John. I figured it out. Thanks for the help. Enjoy your vacation. 2015-08-12 7:14 GMT-05:00 John Stoffel <john@stoffel.org>:
Richard, Sorry I can't answer your questions right now, I'm on vacation without much access to email. Yay!
But the other answers in the thread should get you on the right path.
John _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Hi Richard, On Fri, Aug 7, 2015 at 7:11 PM, Richard Reina <gatorreina@gmail.com> wrote:
replacing the first few lines with:
<html> <body> [KB] Dont you use a main layout? If you are using, above terms should already be at main layout so you dont need at template
<h1>Get in the game.</h1>
<form action="user" method="POST"> First name:<br>
I still get Error 404
Interestingly enough when I modify this http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit to method="POST" it does not work either.
2015-08-07 10:54 GMT-05:00 John Stoffel <john@stoffel.org>:
And I know there's a helper you can use to fill in the action so that you don't have to update the URLs when you deploy it elsewhere.... but I'm at work and not near my notes...
Ah... here it is. Just do:
<form action="user">
And I think you also want to remove the <!DOCTYPE html> as well, since this template will get embedded into alayout which will take care of all that stuff.
John
Andrew> I think what you're after is something like this to tell the browser you want to POST: Andrew> <form action="http://localhost:3000/user" method="POST">
Andrew> Does that do the trick?
Andrew> A
Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina < gatorreina@gmail.com> wrote:
Andrew> Wait, Does this provide a clue to the error of my ways? This is the template (user.tt) that I Andrew> am using for the form.
Andrew> <!DOCTYPE html> Andrew> <html> Andrew> <body>
Andrew> <h1>Get in the game.</h1>
Andrew> <form> Andrew> First name:<br> Andrew> <input type="text" name="firstname"> Andrew> <br> Andrew> Last name:<br> Andrew> <input type="text" name="lastname"> Andrew> <br> Andrew> Email Address:<br> Andrew> <input type="text" name="email"> Andrew> <br> Andrew> User Password:<br> Andrew> <input type="password" name="psw"> Andrew> <br> Andrew> User Confirm Password:<br> Andrew> <input type="password" name="psw2"> Andrew> <br> Andrew> Terms & Conditions Andrew> <input type="checkbox" name="terms"> I agree with terms and conditions.<br> Andrew> <br> Andrew> <input type="submit" value="Go" /> Andrew> </form>
Andrew> <p>Note that the form itself is not visible.</p>
Andrew> <p>Also note that the default width of a text field is 20 characters.</p>
Andrew> </body> Andrew> </html>
Andrew> 2015-08-07 9:36 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew> You need to build a web page with a FORM first, then submit the data Andrew> that way to the /user URL, so it can get handled.
Andrew> Try using git to clone this repository and use that as a base for your Andrew> playing around:
Andrew> https://github.com/agordon/dancer_bootstrap_fontawesome_template.git
Andrew> I don't have any working examples handy right this second...
Richard> I am hoping someone can help me understand how to get this to Richard> work as a POST instead of GET. When I do sub below as 'get' Richard> it works but when I replace 'get' with 'post' I get:
Richard> --2015-08-06 13:52:05-- http://0.0.0.0:3000/user Richard> Connecting to 0.0.0.0:3000... connected. Richard> HTTP request sent, awaiting response... 404 Not Found Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.
Richard> package MyApp; Richard> use Dancer ':syntax'; Richard> use Dancer::Plugin::FormValidator;
Richard> our $VERSION = '0.1';
Richard> post '/user' => sub {
Richard> my $input_hash = {
Richard> FName => param('firstname'), Richard> LName => param('lastname'), Richard> Email => param('email'), Richard> Terms => param('terms'),
Richard> };
Richard> my $number_of_defined_values = scalar grep { defined } values %{$input_hash}; Richard> $number_of_defined_values = $number_of_defined_values + 0;
Richard> if ($number_of_defined_values > 1) {
Richard> my $error = form_validator_error( 'profile_user', $input_hash );
Richard> if ( ! $error ) { Richard> #the user provided complete and validates data it's cool to proceed
Richard> } else {
Richard> my %hash = %$error; Richard> foreach my $k (keys %hash) { Richard> return "$k: $hash{$k}\n";
Richard> }
Richard> } Richard> }
Richard> template 'user';
Richard> ########################################################## Richard> }; ### end of sub user ###################################
Richard> true;
Richard> Thanks in advance for any help.
Richard> _______________________________________________ Richard> dancer-users mailing list Richard> dancer-users@dancer.pm Richard> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Andrew> -- Andrew> Andrew Solomon
Andrew> Mentor@Geekuni http://geekuni.com/ Andrew> http://www.linkedin.com/in/asolomon
Andrew> _______________________________________________ Andrew> dancer-users mailing list Andrew> dancer-users@dancer.pm Andrew> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- *Kadir BeyazlıComputer Engineer* *GSM : +90 535 821 50 00*
participants (8)
-
Andrew Solomon -
James Baer -
John J. McDermott, CPLP -
John Stoffel -
Kadir Beyazlı -
Richard Reina -
Tony Edwardson -
Warren Young