Ok so this is where I stand now:

Page js:

<script type="text/javascript">
//dummy class is my save button , no more submit button
$(".dummy").live("click", function () {
        var $this = $(this);
        var form_id = $this.closest('form').attr("id");
        uRec('#' + form_id);
});
</script> 




External js:


function uRec(selector){
        
        alert(selector); // fires the form id for each form correctly
        
        var $form = $(selector);
        
        
        
        var data = $form.formSerialize();
        var form_url = $form.attr('action');
        var form_target = form_url.substr(1).replace( new RegExp( "/" ,"g"),
"_" );
        var update_target = (form_target.replace("_edit", ""));
        
        alert(form_url + form_target + update_target);


        return false;
        
};

But the only alert is the selector. alert(form_url + form_target +
update_target); never 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 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 example. 
It sounds like your click is not firing now, probably because the click
isn't actually getting bound to the button.

- Jack

Dave Maharaj :: WidePixels.com wrote:
> 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 recordId
>
>       alert(form_id);
>       //uRec(form_id);
>       return false;
>
>       //or  return false; both do nothing
> })
>
>
> </script>
>
> But not even an alert now. Man ohh man
>
> Thanks again for your ideas.
>
> Dave
>
>
>   


No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.725 / Virus Database: 270.14.139/2620 - Release Date: 01/16/10
04:05:00

Reply via email to