Re: [Xsltforms-support] form submission via JavaScript, co-existence w/ jQuery
Brought to you by:
alain-couthures
From: Adam M. <Ada...@gm...> - 2013-03-27 09:23:56
|
Hi Alain, > The test condition could be extended for Javascript: && action.substr(0,11) !== "javascript:" > Could you please test with this? I did try that code change and it fixes the problem for me. The work-around I use is OK, but it's still nicer to avoid such tricks of course. > I think that some XSLTForms users have already mixed it with jQuery. Do you have a test case which > doesn't work? It's been awhile since I tried to use jQuery with XSLTForms. I'm glad to hear they may co-exist now. I was only curious & probably won't try it for awhile. If I have trouble when I do try it, I'll share a test case with you of course. Thanks for your help! /Adam On Mon, Mar 25, 2013 at 3:15 PM, Alain Couthures <ala...@ag...> wrote: > Hi Adam, > >> Looking at xsltforms.js, the line in >> XsltForms_submission.prototype.submit that invokes JS is this one: >> >> eval("ser = (" + action.substr(11) + ");"); >> >> So my work-around is to make the garbage appended to the action >> harmless by making it a comment: >> >> <xf:submission >> id='submit' >> method='get' >> relevant='true' >> replace='instance' >> serialization='application/xml' >> action='javascript:submit(ser));//' >> /> >> >> The line of JS eval'd might be something like: >> >> ser = (submit(ser));//?var1=val1&var2=val2... > > By default, XSLTForms is serializing the current instance with a get method > in the query string: > > if ((method === "get" || method === "delete") && this.serialization > !== "none" && action.substr(0, 9) !== "opener://" && action.substr(0, 8) !== > "local://") { > var tourl = XsltForms_submission.toUrl_(node, this.separator); > action += (action.indexOf('?') === -1? '?' : this.separator) + > tourl.substr(0, tourl.length - this.separator.length); > } > > The test condition could be extended for Javascript: && action.substr(0,11) > !== "javascript:" > > Could you please test with this? > >> Also, can XSLTForms co-exist with jQuery now? Currently I put my >> forms into iframes, which is mostly OK, but it would be nice in future >> to have everything in one integrated page. >> > I think that some XSLTForms users have already mixed it with jQuery. Do you > have a test case which doesn't work? > > Thanks! > > -Alain |