Jump to content

Javascripy Coding Help Needed!


ProspectComm

Recommended Posts

var result = Field("Firstname"); // replace with your first name field
if (Field("Salutation") != "") { // replace with your salutation field
  result = Field("Salutation) + " " + Field("Lastname"); // replace both fields as necessary
}
return result;

Link to comment
Share on other sites

The code above basically reads:

 

1) set RESULT equal to (value of) field Firstname.

2) if field Salutation is not equal to nothing (i.e. it has a value) RESULT equals (value of) field Salutation plus a space plus (value of) field Lastname

3) return value of RESULT

 

While a book will help you, I would suggest googling "javascript" with whatever it is you want to do first. It's more specific and cheaper! There are several sites that explain scripting to a new user. That's pretty much how I learned and if there's anything more complicated that a web page can show me, I ask on the forums. Good luck.

Link to comment
Share on other sites

Alternately:

if (Field("Salutation"))
   return Field("Salutation) + " " + Field("Lastname");
//else
return Field("Firstname");

Or even:

return Field("Salutation") ? Field("Salutation) + " " + Field("Lastname") : Field("Firstname");

Or, getting really tricky:

return Field("Salutation") && Field("Salutation) + " " + Field("Lastname") || Field("Firstname");

:cool:

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...