<div dir="ltr"><div>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.<br><br></div><div>Thanks<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-07 13:22 GMT-05:00 James Baer <span dir="ltr"><<a href="mailto:jamesfbaer@gmail.com" target="_blank">jamesfbaer@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Do not replace POST with the GET. To be clear, you need both route definitions. <br></div>unless you do something like:<br>any ['get', 'post'] => '/user' => sub {<br>};<br></div>but you will probably have to add some logic to check the request method so I recommend just having:<br>get '/user' => sub {<br>};<br></div><div>post '/user' => sub {<br>};<br></div><div><br></div><br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 7, 2015 at 2:17 PM, Richard Reina <span dir="ltr"><<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>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:<br><br>File not found<br><br>Iceweasel can't find the file at <a href="http://0.0.0.0:3000/user" target="_blank">http://0.0.0.0:3000/user</a>.<br><br>    Check the file name for capitalization or other typing errors.<br>    Check to see if the file was moved, renamed or deleted.<br><br></div>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.<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-07 13:03 GMT-05:00 James Baer <span dir="ltr"><<a href="mailto:jamesfbaer@gmail.com" target="_blank">jamesfbaer@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>You still need to have a GET route to display the form:<br><br>get '/user' => sub {<br></div>    template 'user';<br><div><div>}<br><br></div><div>Then when you submit the form it will go to your POST route handler. <br><br></div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 7, 2015 at 1:59 PM, Richard Reina <span dir="ltr"><<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I can't get the page to appear in the browser so I can't press the Go button.<br><br></div>I get:<br><br><h1>Error 404</h1>
<div>
<h2>Page Not Found</h2><span><p>Sorry, this is the void.</p>
</span></div>
<div>
Powered by <a href="http://perldancer.org/" target="_blank">Dancer</a>.
</div><br><div><div><br>This is <a href="http://user.tt" target="_blank">user.tt</a><br><br><!DOCTYPE html><span><br><html><br><body><br><br><h1>Get in the game.</h1><br><br></span><form action="user" method="post"><br>First name:<br><span><br><input type="text" name="firstname"><br></span><br><br>Last name:<br><span><br><input type="text" name="lastname"><br></span><br> <br>Email Address:<br><span><br><input type="text" name="email"><br></span><br><br>User Password:<br><span><br><input type="password" name="psw"><br></span><br><br>User Confirm Password:<br><span><br><input type="password" name="psw2"><br></span><br><br>Terms & Conditions<span><br><input type="checkbox" name="terms"> I agree with terms and conditions.<br><br></span><br> <br><span><input type="submit" value="Go" /><br></span></form><span><br><br><p>Note that the form itself is not visible.</p><br><br></span><span><p>Also note that the default width of a text field is 20 characters.</p><br><br></span></body><br></html><br><br><br></div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-07 12:38 GMT-05:00 Kadir Beyazlı <span dir="ltr"><<a href="mailto:kadirbeyazli@gmail.com" target="_blank">kadirbeyazli@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Richard,<br><br></div>Would you please copy template 'user' here?<br></div>If everything is OK, when you click on "Go" button, POST requests will be performed<br><div><div><br><br></div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 7, 2015 at 8:30 PM, Richard Reina <span dir="ltr"><<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes and just did and tried again to make sure.<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-07 12:16 GMT-05:00 Kadir Beyazlı <span dir="ltr"><<a href="mailto:kadirbeyazli@gmail.com" target="_blank">kadirbeyazli@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Richard,<br><br></div>Did you restart server after you changed GET with POST at form definition?<br></div><br></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Fri, Aug 7, 2015 at 7:58 PM, Richard Reina <span dir="ltr"><<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sorry this is my dancer console output:<br><br>>> Dancer 1.3140 server 24745 listening on <a href="http://0.0.0.0:3000" target="_blank">http://0.0.0.0:3000</a><br>>> Dancer::Plugin::FormValidator (1.131620)<br>== Entering the development dance floor ...<br>[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<br>[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<br>[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<br>[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<br>[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<br>[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<br>[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<br>[24745]  core @0.001956> [hit #1]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181<br>[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<br>[24745]  core @0.000710> [hit #2]response: 304 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 181<br><br><br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-07 11:58 GMT-05:00 Richard Reina <span dir="ltr"><<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This is my dancer console output.<br><br><br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-07 11:11 GMT-05:00 Richard Reina <span dir="ltr"><<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>replacing the first few lines with:<br><br><html><br><body><span><br><br><h1>Get in the game.</h1><br><br></span><form action="user" method="POST"><br>First name:<br><br><br></div>I still get Error 404<br><br></div>Interestingly enough when I modify this <a href="http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit" target="_blank">http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit</a> to method="POST" it does not work either. <br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-07 10:54 GMT-05:00 John Stoffel <span dir="ltr"><<a href="mailto:john@stoffel.org" target="_blank">john@stoffel.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
And I know there's a helper you can use to fill in the action so that<br>
you don't have to update the URLs when you deploy it elsewhere.... but<br>
I'm at work and not near my notes...<br>
<br>
Ah... here it is.  Just do:<br>
<br>
<form action="user"><br>
<br>
And I think you also want to remove the <!DOCTYPE html> as well, since<br>
this template will get embedded into alayout which will take care of<br>
all that stuff.<br>
<br>
John<br>
<br>
<br>
Andrew> I think what you're after is something like this to tell the browser you want to POST:<br>
Andrew> <form action="<a href="http://localhost:3000/user" rel="noreferrer" target="_blank">http://localhost:3000/user</a>" method="POST"><br>
<br>
Andrew> Does that do the trick?<br>
<br>
Andrew> A<br>
<br>
Andrew> On Fri, Aug 7, 2015 at 3:47 PM, Richard Reina <<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>> wrote:<br>
<br>
Andrew>     Wait, Does this provide a clue to the error of my ways? This is the template (<a href="http://user.tt" rel="noreferrer" target="_blank">user.tt</a>) that I<br>
Andrew>     am using for the form.<br>
<br>
Andrew>     <!DOCTYPE html><br>
Andrew>     <html><br>
Andrew>     <body><br>
<br>
Andrew>     <h1>Get in the game.</h1><br>
<br>
Andrew>     <form><br>
Andrew>     First name:<br><br>
Andrew>     <input type="text" name="firstname"><br>
Andrew>     <br><br>
Andrew>     Last name:<br><br>
Andrew>     <input type="text" name="lastname"><br>
Andrew>     <br><br>
Andrew>     Email Address:<br><br>
Andrew>     <input type="text" name="email"><br>
Andrew>     <br><br>
Andrew>     User Password:<br><br>
Andrew>     <input type="password" name="psw"><br>
Andrew>     <br><br>
Andrew>     User Confirm Password:<br><br>
Andrew>     <input type="password" name="psw2"><br>
Andrew>     <br><br>
Andrew>     Terms & Conditions<br>
Andrew>     <input type="checkbox" name="terms"> I agree with terms and conditions.<br><br>
Andrew>     <br><br>
Andrew>     <input type="submit" value="Go" /><br>
Andrew>     </form><br>
<br>
Andrew>     <p>Note that the form itself is not visible.</p><br>
<br>
Andrew>     <p>Also note that the default width of a text field is 20 characters.</p><br>
<br>
Andrew>     </body><br>
Andrew>     </html><br>
<br>
Andrew>     2015-08-07 9:36 GMT-05:00 John Stoffel <<a href="mailto:john@stoffel.org" target="_blank">john@stoffel.org</a>>:<br>
<br>
Andrew>         You need to build a web page with a FORM first, then submit the data<br>
Andrew>         that way to the /user URL, so it can get handled.<br>
<br>
Andrew>         Try using git to clone this repository and use that as a base for your<br>
Andrew>         playing around:<br>
<br>
Andrew>         <a href="https://github.com/agordon/dancer_bootstrap_fontawesome_template.git" rel="noreferrer" target="_blank">https://github.com/agordon/dancer_bootstrap_fontawesome_template.git</a><br>
<br>
Andrew>         I don't have any working examples handy right this second...<br>
<div><div><br>
Richard> I am hoping someone can help me understand how to get this to<br>
Richard> work as a POST instead of GET.  When I do sub below as 'get'<br>
Richard> it works but when I replace 'get' with 'post' I get:<br>
<br>
Richard> --2015-08-06 13:52:05--  <a href="http://0.0.0.0:3000/user" rel="noreferrer" target="_blank">http://0.0.0.0:3000/user</a><br>
Richard> Connecting to 0.0.0.0:3000... connected.<br>
Richard> HTTP request sent, awaiting response... 404 Not Found<br>
Richard> 2015-08-06 13:52:05 ERROR 404: Not Found.<br>
<br>
Richard> package MyApp;<br>
Richard> use Dancer ':syntax';<br>
Richard> use Dancer::Plugin::FormValidator;<br>
<br>
Richard> our $VERSION = '0.1';<br>
<br>
Richard> post '/user' => sub {<br>
<br>
Richard>     my $input_hash = {<br>
<br>
Richard>         FName => param('firstname'),<br>
Richard>         LName => param('lastname'),<br>
Richard>         Email => param('email'),<br>
Richard>         Terms => param('terms'),<br>
<br>
Richard>     };<br>
<br>
Richard>     my $number_of_defined_values = scalar grep { defined } values %{$input_hash};<br>
Richard>     $number_of_defined_values = $number_of_defined_values + 0;<br>
<br>
Richard>     if ($number_of_defined_values > 1) {<br>
<br>
Richard>           my $error = form_validator_error( 'profile_user', $input_hash );<br>
<br>
Richard>          if ( ! $error ) {<br>
Richard>              #the user provided complete and validates data it's cool to proceed<br>
<br>
Richard>          } else {<br>
<br>
Richard>               my %hash = %$error;<br>
Richard>               foreach my $k (keys %hash) {<br>
Richard>                   return "$k: $hash{$k}\n";<br>
<br>
Richard>               }<br>
<br>
Richard>          }<br>
Richard>     }<br>
<br>
Richard>     template 'user';<br>
<br>
Richard> ##########################################################<br>
Richard> }; ### end of sub user ###################################<br>
<br>
Richard> true;<br>
<br>
Richard> Thanks in advance for any help.<br>
<br>
Richard> _______________________________________________<br>
Richard> dancer-users mailing list<br>
Richard> <a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
Richard> <a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
</div></div>Andrew>         _______________________________________________<br>
Andrew>         dancer-users mailing list<br>
Andrew>         <a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
Andrew>         <a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br>
Andrew>     _______________________________________________<br>
Andrew>     dancer-users mailing list<br>
Andrew>     <a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
Andrew>     <a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br>
Andrew> --<br>
Andrew> Andrew Solomon<br>
<br>
Andrew> Mentor@Geekuni <a href="http://geekuni.com/" rel="noreferrer" target="_blank">http://geekuni.com/</a><br>
Andrew> <a href="http://www.linkedin.com/in/asolomon" rel="noreferrer" target="_blank">http://www.linkedin.com/in/asolomon</a><br>
<br>
Andrew> _______________________________________________<br>
Andrew> dancer-users mailing list<br>
Andrew> <a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
Andrew> <a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<div><div>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br><br clear="all"><br></div></div><span><font color="#888888">-- <br><div><div dir="ltr"><div><b><i>Kadir Beyazlı<br>Computer Engineer</i></b></div><div><b><i>GSM : <a href="tel:%2B90%20535%20821%2050%2000" value="+905358215000" target="_blank">+90 535 821 50 00</a></i></b><br></div></div></div>
</font></span></div>
<br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div><div dir="ltr"><div><b><i>Kadir Beyazlı<br>Computer Engineer</i></b></div><div><b><i>GSM : <a href="tel:%2B90%20535%20821%2050%2000" value="+905358215000" target="_blank">+90 535 821 50 00</a></i></b><br></div></div></div>
</div>
</div></div><br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>