Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 666831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:51:43+00:00 2026-05-13T23:51:43+00:00

I have a HAML page that lists some links to delete things that looks

  • 0

I have a HAML page that lists some links to delete “things” that looks like this

%div
   %a.form_submit Delete Thing 1
   %form{:href=>"#", :id=>'comment_1', :method=>'post', :action=>'/thing/delete'}
      %input{:type=>'hidden', :name=>'thingid', :value=>'1'}
      %input{:type=>'submit', style='display:none'}

%div
   %a.form_submit Delete Thing 22
   %form{:href=>"#", :id=>'comment_22', :method=>'post', :action=>'/thing/delete'}
      %input{:type=>'hidden', :name=>'thingid', :value=>'22'}
      %input{:type=>'submit', style='display:none'}

The intention is to have a link “Delete XX” which will delete something specific. A page could have a number of these links, and each link is for a specific “thing”.

I also have a piece of (unobtrusive) jQuery javascript that adds a click handler to each form as follows:

$('a.form_submit').click(function(event) {
    $('form').submit();
    event.preventDefauilt();
});

This works when there is one form on a page. However, if I have more than one form on a page, how do I ensure that clicking “Delete Thing 1” will trigger a submit() event only on the form with id=’comment_1′?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:51:44+00:00Added an answer on May 13, 2026 at 11:51 pm

    i’m not sure but this might work…

    $('a.form_submit').click(function(event) {
        var num = parseInt($(this).text());
        $('form#comment_'+num).submit();
        event.preventDefauilt();
    });
    

    i’ll also suggest to take out :href=>"#", cause it’s not an attribute of a form…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form, that looks like this (sorry for Haml and the german
I have some HAML code like this: .clearfix =f.label t(labels.shortened_urls.fqdn_url) =f.url_field :fqdn_url, {:readonly =>
In a Haml based Padrino solution I have an application.haml like this: !!! %html
I have a haml page which renders without the css that I am trying
If I have a single page with many forms of existing records: index.html.haml -
I have this Haml view: !!! strict %html{:xmlns => http://www.w3.org/1999/xhtml} %head %meta{:content => text/html;
I have a Ruby application, and here is my setup: I have this HAML
I have this in one of my haml views: -form_for :news_item_comment, :url=>{:id => comment.id,
I have a view that takes a Ruby Date, performs some formatting on it
I like HAML . So much, in fact, that in my first Rails app,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.