on 2011 Jul 07 10:12 PM
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?
Thank you
4) No, this line just hides the button Button1.
5) Yes. Comments are just like java ones. You use /* and */ for multiple line comments and // for single line and inline comments.
/*
Multiple
line
comments
*/
//Single line comment
x= 1; //Inline comment
Best Regards, Aldo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
3) I don't understand this question.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1) It's been written by a developer.
2) Pre defined code is enclosed by a comment like this "DO NOT MODIFY THE CODE BEYOND THIS POINT".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
9 | |
8 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.