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 ...
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement