Expand my Community achievements bar.

SOLVED

String Variables......

Avatar

Level 3

Ok,

So I don't quite get how to create Inline substitutions in javascript or adobe because I am trying to do something very simple but it's just now working.  I had some code like follows:

var firstName = "bob";

var lastName = "johnson";

if(object.rawValue == 1){

textField1.rawValue = firstName + " " + lastName;

}

I can't figure out how to get the string data out of the variable to display in a text field or text area.

Justin

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi

The following worked fine for me

var firstname = "Bob";
var lastname = "Johnson";

if (DropDownList1.rawValue == "1"){
TextField3.rawValue = (firstname + " " + lastname);
}else{
TextField3.rawValue = ""
}

View solution in original post

4 Replies

Avatar

Level 3

Greetings Steve,

The object I am referring too is a dropdown list.

Justin

Avatar

Correct answer by
Former Community Member

Hi

The following worked fine for me

var firstname = "Bob";
var lastname = "Johnson";

if (DropDownList1.rawValue == "1"){
TextField3.rawValue = (firstname + " " + lastname);
}else{
TextField3.rawValue = ""
}

Avatar

Former Community Member

I woudl put an alert before the if statement to make sure that you are getting a 1. So your code woudl like like this:

....

var lastname = "Johnson";

app.alert(DropDownList1.rawValue)

if (DropDownList1.rawValue == "1"){
TextField3.rawValue = (firstname + " " + lastname);

.....

My guess is that the rawValue is returning the actual text of the DDlist and not the index.

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----