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 know1) 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"
Views
Replies
Total Likes
Hi,
I can only shed some light:
1:
I don't work with SAP, so can't say for sure how LC Designer and SAP generate code. However when LC Designer auto generates code, it is very clear:
//+ GENERATED - DO NOT EDIT (ID:BFBD1BE2-3120-4E46-8D35-10427D9669D4 CRC:1423498673)
//+ Type: Action
//+ Result1: SetFieldValue("$Node2","tovalue","1")
//+ Node2: form1[0].#subform[0].CheckBox1[0]
//+ Node1: form1[0].#subform[0].Button1[0]
//+ Condition1: Button("$Node1","click")
//+ ActionName: Button1.click
this.resolveNode("CheckBox1").rawValue = "1";
//-
To me the code looks like it was written by the forms developer.
2:
Again not sure, but LC Designer places a specific line and gives the code block a code.
3:
The code is a bit confusing, in that it uses "Street" in three different contexts: (1) it is the name of an object; (2) it is the name of a variable; and (3) it is used in the error message string. Basically what it is doing is if the Street object has a value, set the Street variable to "" so that it does not appear in the error message. Otherwise build it into the error message string. It works, but maybe could be made clearer.
4.
It is basically giving the user potentially one chance to click the button. If there is a problem with the data, then an error message is displayed and the user is prompted to complete the form. If all of the fields are filled in, then there is no error message and the button disappears. Probably not the most user friendly, as the user may not expect the button to disappear. Also the user could go back and delete data in Name, Street, etc.
5.
Yes, green text in the code are comments. The // indicates the start of an inline comment.
Hope that helps,
Niall
Thank you.
But, clarify one more doubt that, Why did he put this code (Kind of CHECK FIELDS) in ONLY one subForm, do u think its a business requirements is like that?
So, for example, if i want to do the same kind (say, CHECK FIELDS) of validation for all the fields on the form (its around 67 subForms and 150 fields) in one shot (i mean, user pressess it after filling all the fioelds on the form), then, where i need to write my code/logic/script?
Thank you
Views
Replies
Total Likes
Hi,
I really can't say why the developer took this approach.
I would recommend that you check out the current version of LC Designer ES2 (v9), as this provides a much improved way of dealing with validation and message handling for the whole form:
Good luck,
Niall
Thank you.
I do not have that version, so i can not see VALIDATIONS tab at all. I am contractor to a company, so, not sure, they will buy it/this version based on my sole request, i dont think they will buy.
So, in that case, pls. let me know How can put CHECK FIELDS functionality for WHOLE form? After filling all the fields user want to press the CHEK FIELDS button, then, we have to check the validity of all fields/subforms in the form. if wrong, i need to throw error message, pls. let me know Wht LEVel i should write script? At each subform level? at body page level? at master page level?
Thank you
Views
Replies
Total Likes
Hi,
You could use the execValidate() method, which will look for mandatory fields that are still blank and fields which fail validation rules that you set.
It depends on what you want. You could check at each stage of the form completion and prompt the user as they complete the form. Or you could wait until the end and validate on preSubmit.
There are a lot of examples on the forums and at http://www.forms.stefcameron.com/ and http://www.blogs.adobe.com/formfeed/.
See the help file for more info.
Niall
Views
Replies
Total Likes
Thank you, your info is really really helpful. I had a glance on the links
provided, not yet gone thru them
Thank you
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies