I'll also point that Form.Request hooks into the submit event of the form.
You should create a new instance of Form.Request and then use a regular
submit button. If you can't do that, just have your link or whatever submit
the form.

On Thu, Feb 3, 2011 at 12:31 PM, Philip Thompson <[email protected]>wrote:

> This doesn't exactly apply to the question you have, but maybe consider
> bringing the "new Form.Request(...)" out of the event function. This way,
> each time you click the button, it won't have to recreate the Form.Request
> object.
>
> var request = new Form.Request(...);
>
> $('submit').addEvent('click', function (e) {
>     ...
>     request.send();
> });
>
> Happy coding,
> ~Philip
>
> On Thu, Feb 3, 2011 at 6:08 AM, websam <[email protected]> wrote:
>
>> I'm using the following codesnipet to send a form:
>>
>> $('submit').addEvent('click', function (e) {
>>    e.stop();
>>
>>    var errorLabel = $$('.lbl_error');
>>    var request = new Form.Request(form, errorLabel, {
>>        resetForm: false,
>>        extraData: {
>>            'content': tinyMCE.activeEditor.getContent()
>>        },
>>        onSuccess: function (resp) {
>>            alert(resp);
>>        }
>>    });
>>    request.send();
>> });
>>
>> However the line alert(resp); returns null even when i see the
>> returned text in firebug. What am I doing wrong here?
>>
>> /Martin
>
>
>

Reply via email to