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:
Saef
Past 24 Hours:
0
Prev. 24 Hours:
0
Overall:
5226
People Online:
Visitors:
521
Members:
0
Total:
521
Online Now:
New Topics
User Group Announcements
Carolina User Group Meeting
12/20/2024 3:15 PM
Date & Time: February 6, 2025, 8:30am - 4:00pm
S3 Systems Administration
ADFS certificate - new cert
12/3/2024 9:38 PM
The certificates on the windows boxes expired and
Lawson S3 HR/Payroll/Benefits
Post Tax Benefit Plan Table
11/14/2024 9:16 PM
Hi, totally new to Laswon. I have a repor
Lawson S3 Procurement
ED501 Error: Map 850 not supported by /law/c15vda/lawson/test10/edi/bin/laws_out_91
11/12/2024 3:47 PM
Tried runnning ED501 and getting the atathced erro
Lawson S3 HR/Payroll/Benefits
Error
11/6/2024 9:54 PM
When I try to enroll a retiree in 72.1 health plan
Infor ERP (Syteline)
Syteline: New Data Maintenance Wizard (Error) Need help
11/1/2024 4:24 PM
Hi, I need help with an error on syteline while us
Dealing with Lawson / Infor
Implementing Lawson v10 with Cerner Surginet, Case Cart Picking, and Quick Adds for the OR
10/29/2024 4:20 PM
Hi Everyone, I am wondering if there is any org
Lawson S3 HR/Payroll/Benefits
Canada Tax Calculation (Federal and Provincial) Issue
10/23/2024 5:00 AM
Initially, we had problem with CPP2 calculation is
Lawson S3 HR/Payroll/Benefits
CA Section 125 401k Plan
10/22/2024 10:13 PM
Does anyone have any recommendations on how to fac
S3 Systems Administration
Running AC120 deleted records from ACMASTER table
10/22/2024 3:40 PM
We recently ran the AC120 as normal and somehow it
Top Forum Posters
Name
Points
Greg Moeller
4184
David Williams
3349
JonA
3291
Kat V
2984
Woozy
1973
Jimmy Chiu
1883
Kwane McNeal
1437
Ragu Raghavan
1372
Roger French
1315
mark.cook
1244
Forums
Filtered Topics
Unanswered
Unresolved
Announcements
Active Topics
Most Liked
Most Replies
Search Forums
Search
Advanced Search
Topics
Posts
Prev
Next
Forums
User Experience
Lawson Design Studio
validating field for each row in the details section of a form
Please
login
to post a reply.
8 Replies
0
Subscribed to this topic
12 Subscribed to this forum
Sort:
Oldest First
Most Recent First
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
Posts: 3353
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
Posts: 3353
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/
Please
login
to post a reply.