Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.9k views
in Technique[技术] by (71.8m points)

How can I give a text input a default value in Elixir/Phoenix?

I have this field

  <%= number_input f, :duration_minutes %>

and I would like to give it a default of 60. How can I do that?

The obvious guess of

  <%= number_input f, :duration_minutes, default: 60 %>

didn't work.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here it is:

  <%= number_input f, :duration_minutes, value: 60 %>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...