You could build your own querystring with the data outside of the form
and the data from the form..
Like:
var myQueryString = 'bla='+$(myField).get('value');
var formQueryString = $(myForm).toQueryString();
var myQueryString += '&'+formQueryString;
new Request({...}).send(myQueryString);
?
On Aug 16, 8:31 pm, hamburger <[email protected]> wrote:
> brook: thats not what i want.
> is easier to add in the data area this:
> 'email': $('email').value,
>
> but i would like to have it more flexible (all form-fields at once and
> my data)
>
> On 16 Aug., 20:02, brook <[email protected]> wrote:
>
>
>
> > oh sorry i missread ...
>
> > there might be a better way but and easy thing to do is something like
>
> > var inpt1 = new Element('input',
> > { name:"commentTold"
> > ,type:"text",value:"this.getParent('li').get('id').split('-')
> > [1].toInt()"})
> > inpt1.setStyle('display','none')
> > document.id('comment-form').grab(inpt1)
>
> > and repeat for the other data and then send the form... that was
> > typed quick some syntax maybe off but thats the idea.
>
> > On Aug 16, 1:30 pm, hamburger <[email protected]> wrote:
>
> > > hi brook,
> > > thx for your answer.
> > > i would like to sent the data-part above and the form content both
> > > together. in your example i send only the form-content
>
> > > On 16 Aug., 19:26, brook <[email protected]> wrote:
>
> > > > hey hamburger.... i think you just want to
> > > > usehttp://mootools.net/docs/core/Request/Request
>
> > > > it'll be something like
>
> > > > var req = new Request({
> > > > url: "autofocus.php",
> > > > data:document.id('comment_form'),
> > > > method: 'post',
> > > > onSuccess: function(resp) {
> > > > // stuff you want to do if it works
> > > > }.bind(this),
> > > > onFailure: function(err) {
> > > > // stuff you want to do if it fails
> > > > }.bind(this)})
>
> > > > req.send()
>
> > > > assuming you have a button which tellls you to send the form you´ll
> > > > have to catch the click and stop it from doing its normal
> > > > thing...before using the above code
>
> > > > On Aug 16, 1:01 pm, hamburger <[email protected]> wrote:
>
> > > > > Hello, how can i send a request with data and the form-content.
>
> > > > > my form is:<form id="comment_form" method="post"
> > > > > action="autofocus.php" >
>
> > > > > i have the following js:
> > > > > SubmitRequest.send({
> > > > > data: {
> > > > > 'commentToId' :
> > > > > this.getParent('li').get('id').split('-')[1].toInt(),
> > > > > 'id': bildID,
> > > > > 'ajax': 'updateComment'
> > > > > }
> > > > > }); //}).post($('comment_form'));
>
> > > > > i expected to add this }).post($('comment_form')); on last line but i
> > > > > get an error.
>
> > > > > what is the right syntax?