Skip to content

Instantly share code, notes, and snippets.

@brianmed
Created March 5, 2015 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianmed/4a4a1e542fec7643fd61 to your computer and use it in GitHub Desktop.
Save brianmed/4a4a1e542fec7643fd61 to your computer and use it in GitHub Desktop.
Odd form related issue with absolute url
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => sub {
my $c = shift;
return $c->render(
template => 'index',
format => 'html',
);
};
app->start;
__DATA__
@@ index.html.ep
%= form_for 'http://dev.supporters.campaignfoundations.com/donate' => ( id => 'cf_supporters_donate' ) => ( method => 'POST' ) => begin
%= csrf_field
<div id="donor_form">
% if ( validation->has_error() ) {
<h3><span style=\"color:red\">Please resubmit the donation form after correcting the following errors:</span></h3>";
% } else {
%= include 'donor_pre_pitch_copy'
% }
<table style="border-style:solid; border-color:green"><tr><td>
<div class="donor">
<tr>
<td>
%= label_for 'donor.fname' => 'First Name'
</td>
<td>
%= text_field 'donor.fname', type => 'text', placeholder => "John"
</td>
</tr>
<tr>
<td>
%= label_for 'donor.lname' => 'Last Name'
</td>
<td>
%= text_field 'donor.lname', type => 'text', placeholder => "Doe"
</td>
</tr>
<tr>
<td>
%= label_for 'donor.phone' => 'Phone'
</td>
<td>
%= text_field 'donor.phone', type => 'text', placeholder => "404-555-1212"
</td>
</tr>
<tr>
<td>
%= label_for 'donor.email' => 'Email'
</td>
<td>
%= text_field 'donor.email', type => 'text', placeholder => "donor\@example.com"
</td>
</tr>
<tr>
<td>
%= label_for 'donor.address1' => 'Address Line 1'
</td>
<td>
%= text_field 'donor.address1', type => 'text', placeholder => "123 Elm Street"
</td>
</tr>
<tr>
<td>
%= label_for 'donor.address2' => 'Address Line 2'
</td>
<td>
%= text_field 'donor.address2', type => 'text', placeholder => ""
</td>
</tr>
<tr>
<td>
%= label_for 'donor.city' => 'City'
</td>
<td>
%= text_field 'donor.city', type => 'text', placeholder => "Our Town"
</td>
</tr>
<tr>
<td>
%= label_for 'donor.state' => 'State'
</td>
<td>
%= text_field 'donor.state', type => 'text', placeholder => "Our State"
</td>
</tr>
<tr>
<td>
%= label_for 'donor.zip' => 'Postal Code'
</td>
<td>
%= text_field 'donor.zip', type => 'text', placeholder => "12345"
</td>
</tr>
<tr>
<td>
%= label_for 'donation.amount' => 'Amount'
</td>
<td>
%= text_field 'donation.amount', type => 'text', placeholder => "100.00"
</td>
</tr>
<tr>
<td>
%= label_for 'donation.lastfour' => 'Last four digits of card number'
</td>
<td>
%= text_field 'donation.lastfour', type => 'text', placeholder => "1234"
</td>
</tr>
</div>
<tr>
<div class="form_button">
<td>
</td>
<td>
<div class="continue">
%= submit_button 'Continue'
</div>
</td>
</div>
</tr>
</table>
</div>
%= end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment