Avatar

Level 8
Hello

When i am checking a custom interactive form, i found the below code in the Form Script (FormCalc), (in the same form, Java Script also used for some subforms)
 
MY_ROOT.PAGE1.companySub.Button1::click - (FormCalc, client)
var Name
var Street
//var CC
//var CZ
//var FN
var Cmsg

if (HasValue(MY_ROOT.PAGE1.custdetailsSub.Name)) then
Name = ""
else
Name = "- Name\u000a"
Cmsg = Name
endif
if (HasValue(MY_ROOT.P1.custdetailsSub.Street)) then
Street = ""
else
Street = "- Street\u000a"
Cmsg = Concat(Cmsg, Street)
endif
//if (HasValue(form1.#subform[0].Table4.Row3.Client_City)) then
//CC = ""
//else
//CC = "Client City\u000a"
//Cmsg = Concat(Cmsg, CC)
//endif
//if (HasValue(form1.#subform[0].Table4.Row4.Client_Zip)) then
//CZ = ""
//else
//CZ = "State/Zip or Province/Postal Code\u000a"
//Cmsg = Concat(Cmsg, CZ)
//endif
//if (HasValue(form1.#subform[4].For_Name)) then
//FN = ""
//else
//FN = "For Client Name"
//Cmsg = Concat(Cmsg, FN)
//endif

if (Cmsg  "") then
Cmsg = Concat("The following field(s) need to be filled before submitting the form.\u000a", Cmsg)
xfa.host.messageBox(Cmsg, "Missing Value", 0, 0)
else
MY_ROOT.PAGE1.companySub.Button1.presence = "hidden"
endif

Pls. let me know

1) Is the above code is created by sysstem (SAP-ADS) itself? or a developer wrote that code manually?

2) How to differentiate a piece of code that its created by system (SAP-ADS) or manullay wrote?

3) Pls. eloborate that wht the above code is doing/validating? bcz am confusing that why code (Name = "" & Street = "") is okay and why it populating Message variable if (Name = "- CoName\u000a" & Street = "- CoName\u000a")? these fields (Name and Street) should get values from user right? if user did not input any value then Error message. !

4)
 CUSTOMER.P1.companySub.Button1.presence = "hidden" 

the above lin eof code in the snippet is saying that 'Hide' the subform, if Name & Street has some values in it, why it should Hide? its displayable filed right?

5) Is green color represents Comments/documentation part?