Login
Register
Search
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Forums
User Experience
Lawson Design Studio
validating field for each row in the details section of a form
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Who's On?
Membership:
Latest:
Wayne Willis
Past 24 Hours:
0
Prev. 24 Hours:
1
Overall:
5190
People Online:
Visitors:
260
Members:
0
Total:
260
Online Now:
New Topics
Lawson Landmark
Executing IPA from PR160
5/3/2024 2:46 PM
We're facing a situation where we need to upda
IPA/ProcessFlow
Executing IPA from PR160
5/3/2024 2:46 PM
We're facing a situation where we need to upda
S3 Customization/Development
Cobol - Extract Current Time
4/24/2024 7:21 PM
How do you extract just the Current System Time in
Lawson Landmark
LPL INSTR Functions
4/5/2024 8:32 PM
I'm writing a simple report using the Create R
Infor SCM
Translating 856 to get the ~ REF^CN^ field
4/3/2024 8:24 PM
We are trying to get the tracking number which is
IPA/ProcessFlow
Sample XML file create Flow
4/3/2024 3:43 PM
Hello everyone, I am new to creating XML files
Lawson S3 HR/Payroll/Benefits
bn105 error message
3/26/2024 6:40 PM
I need to change some of the set ups in our Life I
IPA/ProcessFlow
IPA executing Job
3/13/2024 7:08 PM
New to the IPA world and was wondering, can an IPA
Lawson S3 HR/Payroll/Benefits
Life Age Reduction on benefits plans
3/12/2024 7:15 PM
For our optional life we have an age based coverag
Lawson S3 HR/Payroll/Benefits
BN53.1 Add-In
3/7/2024 3:31 PM
We are migrating to Solstice. They require a
Top Forum Posters
Name
Points
Greg Moeller
4184
David Williams
3349
JonA
3288
Kat V
2984
Woozy
1973
Jimmy Chiu
1883
Kwane McNeal
1437
Ragu Raghavan
1354
Roger French
1311
mark.cook
1244
Forums
Unanswered
Active Topics
Most Liked
Most Replies
Search Forums
Search
Advanced Search
Topics
Posts
Prev
Next
Forums
Lawson Design Studio
validating field for each row in the details section of a form
Sort:
Oldest First
Most Recent First
You are not authorized to post a reply.
Author
Messages
mjcindc
Basic Member
Posts: 8
8/19/2009 8:25 PM
Hi All,
I'm working on and customizaton to PO39.1. I need to iterate through all rows in the details section and check to see if the 'FC' value is 'A' or 'C'. If it is, I want to make sure there is something in the 'sublot' field. With what I've written, it only checks the 'sublot' field on the first row even if the add or change is on another row. As long as the 'sublot' field is populated in row one it accepts the change. This is what I've got so far. It's clear to me I'm missing the iterate through each row part, but I don't have a clue how. Any help is appreciated.
function FORM_OnBeforeTransaction(fc1)
{
if (fc1== "A" || fc1== "C")
{
var sUserFld = lawForm.getFormValue("text3",formState.currentRow);
if (sUserFld == "")
{
lawForm.positionInFieldById("text3");
lawForm.setMessage("Field is required");
return false
}
}
return true;
}
Gary Davies
Veteran Member
Posts: 248
8/19/2009 9:05 PM
The function code passed to OnBeforeTransaction is the Form function code, not the line function code. you need to check the form value the same way you checked the user field
If you only care about the currently selected row then use currentRow, otherwise you will need to loop through the lines with a do (var i=0;i<10;i++)
function FORM_OnBeforeTransaction(FC)
{
if (FC == "A" || FC == "C")
{
var sUserFld = lawForm.getFormValue("text3",formState.currentRow);
var sLineFC = lawForm.getFormValue("fc1",formState.currentRow);
if (sUserFld == "" && (sLineFC == "A" || sLineFC == "C"))
{
lawForm.positionInFieldById("text3");
lawForm.setMessage("Field is required");
return false
}
}
return true;
}
If you only care about the currently selected row then use currentRow, otherwise you will need to loop through the lines with a do
function FORM_OnBeforeTransaction(FC)
{
if (FC == "A" || FC == "C")
{
for (var i=0;i<4;i++) {
var sUserFld = lawForm.getFormValue("text3",i);
var sLineFC = lawForm.getFormValue("fc1",i);
if (sUserFld == "" && (sLineFC == "A" || sLineFC == "C"))
{
lawForm.positionInFieldById("text3",i);
lawForm.setMessage("Field is required");
return false
}
}
}
return true;
}
mjcindc
Basic Member
Posts: 8
8/20/2009 2:08 PM
Thanks, Gary. That second piece of code was exactly what I needed. Of course, success leads to more work and I've got another related question. I'm doing the same change to IC29.1 and it seems I can continue to add lines in the detail section by using page down. I've added 36 lines and have given up the experiment to see if I run out of available lines to populate. Is there a function to get the number of populated lines in the detail area? Something like getRowCount? That's a made up name. It would look like this:
function FORM_OnBeforeTransaction(FC)
{
if (FC == "A" || FC == "C")
{
for (var i=0;i
var sUserFld = lawForm.getFormValue("text3",i);
var sLineFC = lawForm.getFormValue("fc1",i);
if (sUserFld == "" && (sLineFC == "A" || sLineFC == "C"))
{
lawForm.positionInFieldById("text3",i);
lawForm.setMessage("Field is required");
return false
}
}
}
return true;
}
Gary Davies
Veteran Member
Posts: 248
8/20/2009 3:15 PM
There is no stored value of the max lines of a detail area, but you can get it:
var mDetail = lawForm.magic.formWnd.detailColl.getItem("DT0");
if (mDetail) var detailMax = mDetail.rows;
DT0 is the id of the detail area of this example.
mjcindc
Basic Member
Posts: 8
8/20/2009 3:32 PM
Thanks again. This works just as I hoped.
I'm new to JavaScript and Design Studio. I'm a strong SQL programmer with a bit of Java and a lot of Perl in my toolbox, so I figured I could work out the Javascript. I've attempted to find these answers on my own, but I'm a bit discouraged about my chances. When I google javascript and magic.formWnd there are no results. Therefore, I assume these are lawson created objects. Is there some documentation I should be reading to learn this stuff? It's certainly not in the training materials they gave me in my Design Studio class. I'd like to become proficient with Design Studio but the documentation just doesn't seem to be available.
Gary Davies
Veteran Member
Posts: 248
8/20/2009 3:47 PM
That is correct, "magic" is a Lawson specific object. There are good examples at the end of the Design Studio user manual to get a feel of what things you can do.
The rest was learned on the job and with a lot of digging on my part.
John Henley
Senior Member
Posts: 3349
8/20/2009 4:13 PM
There is certainly no "definitive reference" but we consultants do try to share our examples in addition to the ones Lawson provides. One suggestion is that you "invest" in a browser plugin that will let you explore the DOM, etc. --that's how I figure out a lot of stuff.
Terry P
Veteran Member
Posts: 234
9/1/2009 3:04 PM
John - can you be more specific when you talke about a browser plugin. Suggestions, examples of what you can do, etc.
Thanks!
John Henley
Senior Member
Posts: 3349
10/3/2009 10:08 PM
Here's a link to a blog showing the two tools I use:
- Firebug for firefox
- Developer toolbar for IE (built-in to IE8, addon for IE6/IE7)
http://elegantcode.com/20...8-developer-toolbar/
You are not authorized to post a reply.