Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Equivalent code in JavaScript pls?

srinivas1506
Level 8
Level 8

Hello

I want to figure out that the given text field (say, my_text_field_1) has some value in it / is user entered any value in it / is it holding any value in it?

I found the below piece of code in FormCal, but, am looking the same purpose solving code in JavaScript,

var Cmsg

if (HasValue(MY_FORM.P1.MydetailsSub.CoName)) then

CoName = ""

else

CoName = "- CoName\u000a"

Cmsg = CoName

endif

1) Pls. let me know the EQUAVALENT code in JavaScript

2) Also pls. let me know Wht does it mean of "- CoName\u000a"  here?

Thank you

2 Replies
Bibhu_Bikash_Na
Level 9
Level 9

Hi Srinivas,

The following JavaScript code can be the following.

Var Cmsg;

if (HasValue(MY_FORM.P1.MydetailsSub.CoName)) // also you can check as if (FieldName.rawValue) != null

     {

          CoName.rawValue = "";

     }

else

     {

          CoName.rawValue = "_CoName\u00a";

          Cmsg = CoName.rawValue;

     }

All Unicode characters have an equivalent 6 character escape sequence consisting of \u followed by four hexadecimal digits. Within any literal string, it is possible to express any character, including control characters, using their equivalent Unicode escape sequence. For example:

"\u0047\u006f\u0066\u0069\u0073\u0068\u0021"

"\u000d" (carriage return)

"\u000a" (newline character)

Thanks,

Bibhu.

srinivas1506
Level 8
Level 8

Thank you.

1) You said, this also can be achieved by checking !=null, fine,

if user enters a space/blank then, do i need   check like != " " (one space)....okay, if user enters multipe spaces? i do not want to consider the spaces would be some values!

how can i address this item?

thats why i want to go with HasValue

I guess, if user enters the spaces, then, HasValue become FALSE, am i correct?

2)Pls. let me know here in the below, Wht the developer is trying to do? (right now, our system is down, so, i can not test it)

      CoName.rawValue = "_CoName\u00a"; ===> how it looks to the end user, after executing this syntax/script? if developer/designer want to get it in a seperate new line, then, designer could use "\n" right?

CoName is text field in my_form.