Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2007-03-25 19:01:14

quayfee
New member
Registered: 2006-04-01
Posts: 7

prototype library submission

Hi All,

I've got a prblem with submitting a form using the prototype AJAx library. The form has one 'Xinha' textarea and one plain textarea, along with a couple of other fields. Once completed the form is submitted using prototype's Ajax.request method within this function which as called from an onclick event:

function submitForm(myForm,message,serverScript,reloadContent)
    {
        var options = {
            method : 'post',
            parameters : Form.serialize(myForm),
            onSuccess : alert(message)
        };
        new Ajax.Request(serverScript, options);
        doSubNav(reloadContent,'content');
    }

All the data within the form is submitted successfully except the content of the xinha textarea. has anyone come across this before? I'm sure I'm being a numpty but it's starting to bug me now smile

Any suggestions?

CHeers

Keith

Offline

#2 2007-03-26 04:18:31

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: prototype library submission

function submitForm(myForm,message,serverScript,reloadContent)
    {
             myForm.onsubmit(); // you have to trigger this manually, it copies the content of Xinha in the textarea
        var options = {
            method : 'post',
            parameters : Form.serialize(myForm),
            onSuccess : alert(message)
        };
        new Ajax.Request(serverScript, options);
        doSubNav(reloadContent,'content');
    }

Offline

#3 2007-03-26 09:45:46

quayfee
New member
Registered: 2006-04-01
Posts: 7

Re: prototype library submission

Hi Ray,

Thanks for getting back to me so quickly smile

I made the change that you suggested, I now get an error: 'Object does not support this property or method' on that line. The form itself is loaded through an AJAX request updating the page content. Could this be what's causing the issue?

The elements that I'm working on are inside an admin area for a client and they have asked that I not post any URLs, but I could email information to you if you were willing to take a look.

Cheers

Keith

Offline

#4 2007-03-26 11:31:20

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: prototype library submission

Yes, of course smile

Offline

#5 2007-03-27 09:23:21

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: prototype library submission

function submitForm(myForm,message,serverScript,reloadContent)
    {
             document.getElementById(myForm).onsubmit(); // you have to trigger this manually, it copies the content of Xinha in the textarea
        var options = {
            method : 'post',
            parameters : Form.serialize(myForm),
            onSuccess : alert(message)
        };
        new Ajax.Request(serverScript, options);
        doSubNav(reloadContent,'content');
    }

OK, it missed that the argument myForm is a string (as opposed to a DOM object), sorry. Please try this one

Offline

#6 2007-03-27 11:49:26

jedi58
Xinha Authority
From: Leicester, UK
Registered: 2007-01-14
Posts: 113
Website

Re: prototype library submission

since it's prototype, you can replace document.getElementById with $ and not worry wheter it is already a DOM object or a string giving an ID and it will still reference the correct place in the DOM tree.


David G. Paul
[url]http://www.newearthonline.co.uk[/url]

Offline

#7 2007-03-27 13:38:22

quayfee
New member
Registered: 2006-04-01
Posts: 7

Re: prototype library submission

Guys, that's solved it! Many many thanks! big_smile

Offline

Board footer

Powered by FluxBB