Replies: 3 comments 2 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I think this is documented in Mojolicious::Plugin::TagHelpers
<https://docs.mojolicious.org/Mojolicious/Plugin/TagHelpers#toc>
Description:
*Most form helpers can automatically pick up previous input values and will
show them as default. You can also use "param" in
Mojolicious::Plugin::DefaultHelpers to set them manually and let necessary
attributes always be generated automatically.*
The example includes this as well:
*% param country => 'germany' unless param 'country';* <%= radio_button country
=> 'germany' %> Germany <%= radio_button country => 'france' %> France <%=
radio_button country => 'uk' %> UK
…On Tue, Jun 4, 2024 at 4:31 AM Lars Madsen ***@***.***> wrote:
text_field takes the prefilled data from $c->param, so you use $c->param(
name => $user->name // '' ); in your controller.
—
Reply to this email directly, view it on GitHub
<#2185 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD6K6REJP25A4UKHBZ5DZLZFWCPPAVCNFSM6AAAAABIYAAVZWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TMNRRHE3DK>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
@daleif thanks, sometimes I forgot how easy and consistent Mojolicious is! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I use
Mojolicious::Plugin::TagHelpers
to design my form templates, and I've fields like the following one:How can I prefill the field with the value of stashed variable
$user->name
if set? So I would like to inject a value like$user ? $user->name : ''
but I cannot find how to instrument thetext_field
appropriately.Beta Was this translation helpful? Give feedback.
All reactions