variables in queries...

… sorry, i am not sure, which of the forums is the correct one for posting this question, the jscript forum or the xquery forum…

-

i’m doing a query on tamino with a html-frontend, where several JavaScript forms are used to define Query parameters. right now i have the following prob, that i can read the value of a variable posted into my function (nearly the same as in the jstest.htm example), but i can’t use it in a query-string. i think it’s a semantic problem.

the function:

  <BR>function ChangeZip (xyz) {<BR>...<BR>var QueryVal='clients[name/surname=xyz]'; //does not work<BR>document.write(xyz); //does work<BR>...<BR>}<BR>




i’m no crack, thats why i’m asking such stupid questions :wink:

any hints here?
thanks
ak.

The problem is that the query is
‘clients[name/surname=xyz]’

Your variable is xyz but the above is using string xyz because it’s inside the quotes.

You need to construct a query, for example…

queryString=‘clients[name/surname="’+xyz+‘"]’

Now I’m no expert on Jscript so the above might not be completely valid but it’s on the right lines.

This should get the value of the passed variable into the querystring.