Skip to content

Commit

Permalink
slightly more diverse examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 16, 2015
1 parent 3f6e564 commit 23f1a3e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -849,10 +849,10 @@ parameter.
# PUT /nothing
# POST /nothing?_method=PUT
put '/nothing' => sub {
my $c = shift;
my $value = $c->param('whatever');
my $c = shift;

# Prevent double submit with redirect
# Prevent double form submission with redirect
my $value = $c->param('whatever');
$c->flash(confirmation => "We did nothing with your value ($value).");
$c->redirect_to('form');
};
Expand All @@ -868,7 +868,7 @@ parameter.
<p><%= $confirmation %></p>
% }
%= form_for nothing => begin
%= text_field 'whatever', value => 'I ♥ Mojolicious!'
%= text_field whatever => 'I ♥ Mojolicious!'
%= submit_button
% end
</body>
Expand Down Expand Up @@ -980,7 +980,7 @@ L<Mojolicious::Validator::Validation/"error">.
# Render form again if validation failed
return $c->render('form') if $validation->has_error;

# Prevent double submit with redirect
# Prevent double form submission with redirect
$c->flash(number => $validation->param('number'));
$c->redirect_to('form');
};
Expand Down
32 changes: 16 additions & 16 deletions lib/Mojolicious/Plugin/TagHelpers.pm
Expand Up @@ -406,14 +406,14 @@ Generate portable C<img> tag.
=head2 input_tag
%= input_tag 'first_name'
%= input_tag first_name => 'Default name'
%= input_tag first_name => 'Default'
%= input_tag 'employed', type => 'checkbox'
Generate C<input> tag. Previous input values will automatically get picked up
and shown as default.
<input name="first_name">
<input name="first_name" value="Default name">
<input name="first_name" value="Default">
<input name="employed" type="checkbox">
=head2 javascript
Expand Down Expand Up @@ -685,35 +685,35 @@ get picked up and shown as default.
=head2 text_area
%= text_area 'foo'
%= text_area 'foo', cols => 40
%= text_area foo => 'Default!', cols => 40
%= text_area foo => (cols => 40) => begin
Default!
%= text_area 'story'
%= text_area 'story', cols => 40
%= text_area story => 'Default', cols => 40
%= text_area story => (cols => 40) => begin
Default
% end
Generate C<textarea> tag. Previous input values will automatically get picked
up and shown as default.
<textarea name="foo"></textarea>
<textarea cols="40" name="foo"></textarea>
<textarea cols="40" name="foo">Default!</textarea>
<textarea cols="40" name="foo">
Default!
<textarea name="story"></textarea>
<textarea cols="40" name="story"></textarea>
<textarea cols="40" name="story">Default</textarea>
<textarea cols="40" name="story">
Default
</textarea>
=head2 text_field
%= text_field 'first_name'
%= text_field first_name => 'Default name'
%= text_field first_name => 'Default name', class => 'user'
%= text_field first_name => 'Default'
%= text_field first_name => 'Default', class => 'user'
Generate C<input> tag of type C<text>. Previous input values will automatically
get picked up and shown as default.
<input name="first_name" type="text">
<input name="first_name" type="text" value="Default name">
<input class="user" name="first_name" type="text" value="Default name">
<input name="first_name" type="text" value="Default">
<input class="user" name="first_name" type="text" value="Default">
=head2 time_field
Expand Down

0 comments on commit 23f1a3e

Please sign in to comment.