WebDialog question
-
hello, I want to pass two parameters like this:
query = 'skp;send_values@' + val1 + 'WHAT HERE?' + val2;
but I don't know how to concatenate val 1 + val2. I tried with @, with &, but doesn't work.
Any suggestion ? -
@newone said:
hello, I want to pass two parameters like this:
query = 'skp;send_values@' + val1 + 'WHAT HERE?' + val2;
but I don't know how to concatenate val 1 + val2. I tried with @, with &, but doesn't work.
Any suggestion ?Unless val1 and val2 are strings, you need to convert them to strings.
Useval1.toString()
Fredo
-
@unknownuser said:
Unless val1 and val2 are strings, you need to convert them to strings.
Useval1.toString()
Fredo
I need them as array elements in ruby, that is why I want to concatenate them as separate parameters.
-
@newone said:
I need them as array elements in ruby, that is why I want to concatenate them as separate parameters.
In Javascript you can use the .join() function (very similar to the Ruby one) to convert a list to a string with separator.
for instanceval1.join(';')
.The only thing you have to keep in mind is that the transmission to Ruby is done with a String after the @. So up to you to encode in JavaScript and decode in Ruby.
Fredo
-
@unknownuser said:
@newone said:
I need them as array elements in ruby, that is why I want to concatenate them as separate parameters.
In Javascript you can use the .join() function (very similar to the Ruby one) to convert a list to a string with separator.
for instanceval1.join(';')
.The only thing you have to keep in mind is that the transmission to Ruby is done with a String after the @. So up to you to encode in JavaScript and decode in Ruby.
Fredo
Thanks! This is what I am going to do. I will separate the string in ruby, to get desired array.
-
You might want to think about using JSON. It's a bit more general, can be really light weight and if you know JavaScript you already know JSON. Example:
JSON array: comma-separated list of items enclosed in square brackets.
Sample: ['string one', 'string two']
It's a wee bit of extra work, but if you ever want to share data elsewhere ...
Advertisement