Hide or remove line FC

 2 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
David Williams
Veteran Member
Posts: 1127
Veteran Member
We need to remove the line FC field from our form. How can you do that?
David Williams
John Henley
Posts: 3362
David, not sure what your specific requirements are, but I did this in the Grant Management application, which is outlined here: https://www.lawsonguru.co...t-All-Together.aspx.

Here are some code snippets showing some of the technique I used.  Basically, it figured out whether LINE-FC needed to be set to a 'C' or not.  Note that in this application, LINE-FC = D and/or A were not applicable.

First, hide LINE-FC in the form definition:
<code> <fld al="left" col="1" det="DT0" detfc="1" ed="upper" hdet="1" hsel="1" id="hidden19" nbr="_f26r0" nm="LINE-FC" oc="0" par="DT0" row="1" rowid="0" sz="1" tp="Hidden"></fld></code> Then, when form is initialized, set LINE-FC to blank on all rows: <code> function FORM_OnInit() {<br />   // initialize line FC to blank on all rows<br />   for (var nRow=0; nRow < 11; nRow++) {<br />   lawForm.setDataValue("LINE-FC","",nRow);<br />   } <br /> }</code>

Finally, when posting the transaction, use some logic (in this app it was based on there being a LINE-NBR value on the row), set LINE-FC to 'C'
<code><br /> function FORM_OnBeforeTransaction(fc) {<br />   // user clicked change; based on fields with values entered, set LineFC = "C"<br />   if(fc == "C") {<br />     zeroLinesBeforeChange()<br /> <br />     for (var nRow=0; nRow < 11; nRow++) {<br />       lawForm.setDataValue("LINE-FC","",nRow);<br />       if (lawForm.getDataValue("LINE-NBR",nRow) != '') {<br />         lawForm.setDataValue("LINE-FC","C",nRow) }<br />        }<br />   }<br />   return true;<br /> }</code>
Thanks for using the LawsonGuru.com forums!
John
David Williams
Veteran Member
Posts: 1127
Veteran Member
Thanks, John. That's exactly what we needed.
David Williams