Expand my Community achievements bar.

combine text raw.values and stored text into one output field ?

Avatar

Level 4

Hi,

I have attached a commented form that explains fully what i'm trying to do... but basically, i'd like to take user entered text raw.values and combine them with "stored text" to produce output text that is determined by the users selections....

so is user name is Dave Smith and Dave selects option 2 on a dropdown list then you get

"Hi, Dave Smith, you have chosen option two from the list" as raw.value for another filed/output to a text box (for test purposes)" and so on for options 1,3,4,5 each having totally different text associated with that option, so choice 4 would be "Dave Smith is a moron cause he chose wrong dude!" or whatever.

Ideally i'd like to be able to create "canned text" for the choices that intergrate the insert points naturally e.g. a canned text for choice 2 above might look like " Hi, {firstname.rawValue} {secondname.rawvalue}, you have chosen option two from the list" with script splicing into the output the matched field name rawValues - essentially letting you write the content of the output and the code reference raw.values and substitutes the rawvalue value for anymatching filed names specified in the canned text by { } or whatever marker works

thats the ideal, but i'm guessing breaking it apart further might be necessary??

anyway, have a look at the example (it makes more sense) and any code samples/ideas would be great.........

I'm only able to do javascript for this work so.........   

thanks

1 Reply

Avatar

Level 4

OK, got something working, this seems to work (though crude) roughly as i'd hoped

a switch statement is attached to the dropdown list.....

switch (this.rawValue) {

     case "1":

     {output.rawValue = "Hello my name is " + FirstName.rawValue + " " + Surname.rawValue + " I like apples"}

          break;

     case "2":

          {output.rawValue = FirstName.rawValue + " " + Surname.rawValue + " says that you like Oranges very much"}

           break;

case "3":

         {output.rawValue = "So they tell me, Mr. " + FirstName.rawValue + " " + Surname.rawValue + " that you like Peaches"}

}

what we need to be able to do now, the bit i'm still stuck on is force the formatting on the FirstName.rawValue and Surname.rawValue on a instance by instance basis

so if we use them for X.rawvalue then they must be spliced in as ALL CAPS, whereas if we use them for Y.rawvalue they have to be in caps or sentence case or lowercase

can you add code to something like the above to go:

switch (this.rawValue) {

     case "1":

     {output.rawValue = "Hello my name is " + FirstName.rawValue (BUT IT'S ALL CAPS -SOMEHOW) + " " + Surname.rawValue + " I like apples"}

          break;

     case "2":

          {output.rawValue = FirstName.rawValue + " " + Surname.rawValue (+ IT'S Sentence Caps -SOMEHOW) + " says that you have to be a real sissy boy to like Oranges like you do"}

etc etc

thanks guys