I have sets of records on a page each has an edit link, clicking the link
loads an edit form into the record the user wants to edit, so a user can
click edit beside every link creating an unknown number of forms on the
page.
li id=r_123 user records edit /li
li id=r_456 user records edit
This may or may not help you, but often in situations like this what I
do is use .closest() to get the id that I need for the edited record,
like this:
ul id=forms
li id=r_123 class=recordyour form gets injected here/li
li id=r_456 class=recordyour form gets injected here/li
/ul
I have changed my page js to:
script type=text/javascript
$(form).bind(submit, function() {
var form_id = $(this).attr('id');
alert(form_id);
uRec(form_id);
return false;
})
/script
The alert shows the form id for the form i am attempting to submit and it
If uRec is still like it was before:
function uRec(selector){
var $form = $(selector);
in the example below you're passing it an id, so try:
var $form = $('#' + selector);
I was suggesting changing the button type from submit to button, yes.
It's no big deal, but at least it will
I have completely removed the uRec function for now and changed to a regular
button, no submit.
input type=button value=Button/
/form
script type=text/javascript
$(button).click(function () {
var form_id = '#123123123';
//var form_id = $this.closest('form'); // get the
Ok im getting closer. This gives me the id for each form being submitted,
the alert(selector); in the external js fires off so its getting the
request, but the form now does not submit...just stis there laughing at me.
Page js:
script type=text/javascript
//dummy class added to button to test it
If you're rendering the button on-the-fly (as part of your form) be sure
to either a) hook up that button click handler after the button is
rendered or b) use the event delegation approach I showed in my example.
It sounds like your click is not firing now, probably because the click
isn't
fires off.
I think im getting there but still this is all new to me so it more trial
and error than anything.
Thanks,
Dave
-Original Message-
From: Jack Killpatrick [mailto:j...@ihwy.com]
Sent: January-16-10 7:51 PM
To: jquery-en@googlegroups.com
Subject: Re: [jQuery] Complicated
: January-16-10 7:51 PM
To: jquery-en@googlegroups.com
Subject: Re: [jQuery] Complicated Question
If you're rendering the button on-the-fly (as part of your form) be sure to
either a) hook up that button click handler after the button is rendered or
b) use the event delegation approach I showed in my
9 matches
Mail list logo