Question

#social_list
  = form_tag notes_path, class: 'form clearfix', id: 'add_post_form',multipart: true, remote: true 
  .control-group
    = text_area_tag "comment[text]", '', :placeholder => 'Post to the community', :cols => nil, :rows => nil, :class => 'mention expand-without-submit'
    = file_field_tag "picture", id:'image_upload', accept: 'image/png,image/gif,image/jpeg'
    = submit_tag "Post your message", class: 'btn btn-success btn-mini'

  = form_tag images_path
    = submit_tag 'asad'  

  = render "dashboards/activity_stream_filter"

I want to add second form but it is giving me this error.

syntax error, unexpected keyword_ensure, expecting $end

I guess some scoping issue is messed up or is the possible to have multiples form in single page ?

Was it helpful?

Solution

The form_tag method takes a block for the form contents. In your first form you have’t provided a block at all since nothing is indented below it. In the second case there is content indented below, but you haven’t included the do. This second case is causing the syntax error.

What I think you want is

#social_list
  - # note 'do' added to this line:
  = form_tag notes_path, class: 'form clearfix', id: 'add_post_form',multipart: true, remote: true do
    - # this section indented:
    .control-group
      = text_area_tag "comment[text]", '', :placeholder => 'Post to the community', :cols => nil, :rows => nil, :class => 'mention expand-without-submit'
      = file_field_tag "picture", id:'image_upload', accept: 'image/png,image/gif,image/jpeg'
      = submit_tag "Post your message", class: 'btn btn-success btn-mini'

  - # 'do'added to next line
  = form_tag images_path do
    = submit_tag 'asad'  

  = render "dashboards/activity_stream_filter"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top