Jump to content

Return value script


hrueda

Recommended Posts

Assuming you're asking because the value of 'x' is also a numeric value and you don't want the two values to be added together, you need to convert the two values to a string:

return String(1) + String(23); // returns 123

 

If you had more than just two numbers you might find it easier to use an array:

return [1,2,3].join(''); // returns 123

Link to comment
Share on other sites

I will reiterate as I think I was vague before.

 

When a user enters a 3 digit number which will be used for a phone extension I would like a script that will place an x in front of those 3 digits.

 

Thanks

Link to comment
Share on other sites

When a user enters a 3 digit number which will be used for a phone extension I would like a script that will place an x in front of those 3 digits.

And if the user enters something else then...what?

var s = Field("YourFieldName");
if (s.match(/\d{3}/))
   return "x" + s;
//else
return s;
// OR ???
return "";

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...