Skip to content

Prefill an email_field with a template expression value #2159

Closed Answered by fluca1978
fluca1978 asked this question in Q&A
Discussion options

You must be logged in to vote

I think I've solved by myself, but I would like to get a confirm or suggestion if this is not the best solution.
Since %= starts a Perl line evaluation, I do not need to embed <%= and I can insert the perl expression in the line:

%= email_field 'email' => ( $user && $user->is_logged_in ? $user->email : '' ),  id => 'email', class => 'form-control'

which produces:

<input class="form-control" id="email" name="email" type="email" value="[email protected]">

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ghandmann
Comment options

@fluca1978
Comment options

Answer selected by fluca1978
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants