[jQuery] Re: Form Plugin: editing/adding data before send

2008-11-06 Thread Mike Alsup
> Ooooh, right, I didn't think of that (I am fairly new to making stuff with > ajax). I guess there is no way to make the ajaxForm function wait for this > particular response? But I guess this is a different topic now.. The way to do it is to return false from the beforeSerialize function; that

[jQuery] Re: Form Plugin: editing/adding data before send

2008-11-06 Thread Spikx
malsup wrote: > > This sort of thing comes up a lot so I've added a new callback > function called 'beforeSerialize'. You can use it like this: > > var ajaxFormOptions = { > beforeSerialize: function($form, opts) { > $("#hidden_input").attr("value","test"); > } > }; > > $('#f

[jQuery] Re: Form Plugin: editing/adding data before send

2008-11-06 Thread Spikx
malsup wrote: > > >> but for some reason the input field stays empty this way: > > Yeah, that reason is known as asynchronous programming. When you make > that ajax call you will get a response some time in the future, not > immediately. > > Ooooh, right, I didn't think of that (I am fai

[jQuery] Re: Form Plugin: editing/adding data before send

2008-11-06 Thread Mike Alsup
> but for some reason the input field stays empty this way: Yeah, that reason is known as asynchronous programming. When you make that ajax call you will get a response some time in the future, not immediately.

[jQuery] Re: Form Plugin: editing/adding data before send

2008-11-06 Thread Spikx
Ok, it seems I still need help here. var ajaxFormOptions = { beforeSerialize: function(){ $("#hidden_input").attr("value","test"); } }; $('#form').ajaxForm(ajaxFormOptions); works fine now :). However, in reality, I don't want to set the value of the input field to an arbitrary value, I actua

[jQuery] Re: Form Plugin: editing/adding data before send

2008-11-06 Thread Mike Alsup
> I am using the jQuery Form Plugin to submit a form via AJAX. One thing I'd > like to do, is editing the value of a (hidden) input field, right before the > form is sent (or alternatively adding additional POST data in some way > before send). I defined a hidden input field (without a value) in t