Hi All,

I have a new.haml contact form which user will enter the information
in the contact form.
Currently, the form only has one email input text. I add a button
"Another email", when user click on the button, I would want to create
a new email input text.

How would I achieve this in Haml? I saw a lot of example to use
javascript adding an input text at runtime, but I don't know how to
use it with Haml.

My form is below.

Thanks for your help,
Luan

#content
  %h1 New Contact
  %form{:method => "post", :action => "/contacts/create"}
    %label First Name:
    %input{:type => "text", :id => "first_name", :name =>
"first_name", :value => ""}
    %br
    %label Last Name:
    %input{:type => "text", :id => "last_name", :name =>
"last_name", :value => ""}
    %br
    %label Phone:
    %input{:type => "text", :id => "phone", :name => "phone", :value
=> ""}
    %br
    %label Email:
    %input{:type => "text", :id => "email", :name => "email", :value
=> ""}
    %label Email Type:
    %select{:name => "email_type"}
      - @email_types.each do |type|
        %option{ :value => type}= type
    %input{:type => "button", :value => "Add Email"}
    %br
    %input{:type => "submit", :value => "Add"}

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to