EDPX HED COMPONENT

<!– ############################################## –>
<!– ### !@BEGIN Page Component PAG_HED     ### –>
<!– ############################################## –>
<script type=”text/JavaScript”>
<!–

//* This is an attempt to eventually pull out the file level
//* validations from the LANSA repository to be applied on client side

function validateForm()
{
var myattr=new Array();
bldAttrArray(myattr);
if(chkreqelements(myattr,’form’))
 {mapValuesBack();return(true);} else {return(false);}
if(customValidations) {return(true);} else {return(false);}
}
function validateField(vfieldobj)
{
var myfieldobj=vfieldobj;
var myfieldattr=new Array();
bldFieldAttrArray(myfieldobj,myfieldattr);
if(!chkreqelements(myfieldattr,’field’)) ErrField(myfieldobj);
}

function bldAttrArray(bldattrarr)
{
var attstr=”what is in new array\n\n”;
var attnodeName=””;
var attnodeValue=””;
var k=0;
    for(i=0;i<document.LANSA.elements.length;i++)
    {
        for(j=0;j<document.LANSA.elements[i].attributes.length;j++)
          {
        attnodeName=document.LANSA.elements[i].attributes[j].nodeName.toUpperCase();
        if(attnodeName==”EDPX”)
        {
        attnodeValue=document.LANSA.elements[i].attributes[j].nodeValue;
        attnodeValue=attnodeValue.toUpperCase();
        k=bldattrarr.length;
        bldattrarr[ k ]=document.LANSA.elements[i].id+”:”+attnodeValue;
        attstr += bldattrarr[ k ]+”  “;
        attstr += “\n”;
        }
        }
    }
    //* remove comment bellow to see all EDPX elements in form
    //*alert( attstr );
 }

function bldFieldAttrArray(fieldobj,fieldattarr)
{
var fieldattobj=fieldobj;
var fieldattstr=”what is in field array\n\n”;
var fieldattnodeName=””;
var fieldattnodeValue=””;
var k=0;
        for(j=0;j<fieldattobj.attributes.length;j++)
          {
                fieldattnodeName=fieldattobj.attributes[j].nodeName.toUpperCase();
                if(fieldattnodeName==”EDPX”)
                {
                        fieldattnodeValue=fieldattobj.attributes[j].nodeValue;
                        fieldattnodeValue=fieldattnodeValue.toUpperCase();
                        k=fieldattarr.length;
                        fieldattarr[ k ]=fieldattobj.id+”:”+fieldattnodeValue;
                        fieldattstr += fieldattarr[ k ]+”  “;
                }
          }
     fieldattstr += “\n”;
    //* remove comment bellow to see all EDPX elements in form
    //* alert(fieldattstr);
 }
function chkreqelements(attarr,atttyp)
{
var cremsg=”The Following errors have been found: “;
//* For LANSA users Messages can be put in a browse list *NOBICP then do a merge list here
var crems00=”is required and must be entered”
var crems01=”has bad address “;
var crems02=”has invalid characters a-z A-Z “;
var crems03=”has invalid characters a-z A-Z 0-9 “;
var crems04=”is not a number “;
var crems05=”can not be a number “;
var crems06=”is invalid date “;
var crems07=”is not an acceptable range for Date of Birth “;
var crems08=”is invalid format ###-##-#### “;
var crems09=” “;
var crems10=” “;
var crems11=” “;
var crems12=” “;
var crems13=” “;
var crems14=” “;
var crems15=” “;
var crems99=”ERROR COUNT ->  “;
var creid=””;
var creval=””;
var crestr=””;
var dotdot=0;
var creobj=””;
var crereq=””;
var cretyp=””;
var cretxt=””;
var errcnt=0;
var cretmp=””;
cremsg += “\n\n”;

  for(i=0;i<attarr.length;i++)
    {
      crestr=attarr[i];
      dotdot=crestr.indexOf(“:”);
      creid=crestr.substr(0,dotdot);
      creval=crestr.substr(dotdot+1,crestr.length-1);
      crereq=creval.match(“REQ”);
      creobj=document.getElementById(creid);
      creobj.value=trimTrailingBlanks(creobj.value);
      credesc=creobj.name;

      if(creobj.title) {credesc=creobj.title;}
      if(creobj.value.length == 0)
          {
                 //* Format of message here
                 cretmp=credesc+” as NULL => ”
                 if(creval.match(“REQ”)) {errcnt=errcnt+1;cremsg +=cretmp+crems00+”\n”;}

          }
          else
            {
                 //* Format of message here
                 cretmp=credesc+” as “+creobj.value+”  => ”

                 //* Add new validation checks here
                 if(creval.match(“EML”)) {if(!emailValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems01+”\n”;}}
                 if(creval.match(“A2Z”)) {if(!isAlpha(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems02+”\n”;}}
                 if(creval.match(“A29″)) {if(!isAlphanumeric(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems03+”\n”;}}
                 if(creval.match(“NUM”)) {if(!isNumeric(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems04+”\n”;}}
                 if(creval.match(“NAN”)) {if(isNumeric(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems05+”\n”;}}
                 if(creval.match(“DTE”)) {if(!dmyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems06+”\n”;continue}}
                 if(creval.match(“DOB”)) {if(!dmyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems07+”\n”;}}
                 if(creval.match(“SSN”)) {if(!isSSN(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems08+”\n”;}}
                 if(creval.match(“ZIP”)) {if(!isZipcodeUSA(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems09+”\n”;}}
                 if(creval.match(“ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems10+”\n”;}}
                 if(creval.match(“ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems11+”\n”;}}
                 if(creval.match(“ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems12+”\n”;}}
                 if(creval.match(“ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems13+”\n”;}}
                 if(creval.match(“ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems14+”\n”;}}
                 if(creval.match(“ZZZ”)) {if(!dummyValidator(creobj)){errcnt=errcnt+1;cremsg +=cretmp+crems15+”\n”;}}

               }

      }
 if(errcnt!= 0)
    {
     if(errcnt!=1) cremsg+=”\n”+crems99+errcnt;
     if(atttyp==’form’) alert( cremsg );
     return(false);
    }
  else
    {return(true);}
 }

function trimTrailingBlanks(TrimtrailingblanksValue)
{trim=TrimtrailingblanksValue;
 if (trim.length==0) return trim;
 for (var i=trim.length-1;i>=0;i–) if (trim.substring(i,i+1) !=’ ‘) {i++;break;}
 if (i<0) i=0;
 trim=trim.substring(0,i);
 return trim;
}
//* ==============================================
//* Validation functions — Add new functions here
//* ==============================================

function isNumeric(elem){
        var numericExpression = /^[0-9]+$/;
        if(elem.value.match(numericExpression)){
                return true;
        }else{ return false;}
}

// If the element’s string matches the regular expression it is all letters
function isAlpha(elem){
        var alphaExp = /^[a-zA-Z]+$/;
        if(elem.value.match(alphaExp)){
                return true;
        }else{ return false;}
}

// If the element’s string matches the regular expression it is numbers and letters
function isAlphanumeric(elem){
        var alphaExp = /^[0-9a-zA-Z]+$/;
        if(elem.value.match(alphaExp)){
                return true;
        }else{ return false;}
}

function lengthRestriction(elem, min, max){
        var uInput = elem.value;
        if(uInput.length >= min && uInput.length <= max){
                return true;
        }else{ return false;}
}

function emailValidator(elem){
        var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
        if(elem.value.match(emailExp)){
                return true;
        }else{ return false;}
}

function dummyValidator(elem){
        if(elem==elem){
                return true;
        }else{ return false;}
}

function ssnValidation(elem) {
    var ssn = elem.value;
    var matchArr = ssn.match();
    var numDashes = ssn.split(‘-‘).length – 1;
    if (matchArr == null || numDashes == 1 || (parseInt(matchArr[1],10)==0)) {return false;}   else {  return true;}}
function isSSN(elem){
        var numericExpression = /^(\d{3})-?\d{2}-?\d{4}$/;
        if(elem.value.match(numericExpression)){
                return true;
        }else{ return false;}
}
function isZipcodeUSA(elem)
{
  var iszip = elem.value;
  var numDashes = elem.value.split(‘-‘).length – 1;
  var islength = elem.value.length;
     if (islength == 5)
       {
         if(isNumeric(elem))
           {
             return true;
             } else { return false;}
       }
}

//#######################################
//### Highlight/Unhighlight Focused Input Fields
//#######################################
function focusWork(focusworkThis,focusworkEvent)
{var Event=focusworkEvent;
 var This=focusworkThis;
 if (Event.type==’focus’) This.style.backgroundColor=’Yellow’;
 if (Event.type==’blur’)
     { This.style.backgroundColor=’White’;
       validateField(This);}
}
//#######################################
//### Error Notify Red Background Fields
//#######################################
function ErrField(errfieldThis)
{ var This=errfieldThis;
  This.style.backgroundColor=’Pink’;
 }

function isCustom()
{
//* Put your custom specific validations here (false=fail)
if(‘a’ == ‘a’) {return(true);}
       else {return false;}
}

function switchInputType(SwitchinputtypeBase,SwitchinputtypeObjectID)
{
 var objectSW=document.getElementById(SwitchinputtypeObjectID);
 var baseSW=SwitchinputtypeBase;
   baseSW.value=objectSW.value;
 var masag=’Value is/’+baseSW.value;
 alert(masag);
 debugAlert(baseSW);
}

function mapValuesBack()
{
  //switchInputType(document.LANSA.AZFNAMEMMM,’FNAME’);
  //switchInputType(document.LANSA.AZLNAMEMMM,’LNAME’);
  document.LANSA.ASTDRENTRY.value=’N’;
  HandleEvent(‘<RDML MERGE=”*PROCESS”>’,'<RDML MERGE=”*FUNCTION”>’);
}

//#####################################################
//### Alert to Show Object Properties
//#####################################################
function debugAlert(AlertObject)
{ var i = 0 ; a = “”;
// list all window properties in a variable
for ( property in AlertObject )
{a += ( i ) + ” ” + property + “…”;
i ++;
if(i % 5 == 0) a += “\n”;
}
// display the window properties list
alert( a );
}

//–>
</script>
<!– ############################################## –>
<!– ### !@END    Page Component PAG_HED      ### –>
<!– ############################################## –>

3 ways to invoke DEBUG for LANSA for the Web

document.LANSA.ASTDRENTRY.value=”N”;
   document.LANSA._PROCESS.value=Proc;
   document.LANSA._FUNCTION.value=Func;
   document.LANSA.action+=”+BDEBUG+QPADEV000Q”;
   document.LANSA.submit();

or

<form method=”post” name=”LANSA”
action=”/<RDML MERGE=”&CGI”>/LANSAWEB?WEBEVENT+<RDML MERGE=”&SESSPL”>+bdebug+QPADEV000H”>

or

http://lansa.com/cgi-bin/lansaweb?procfun+mamcomproc+mlogon+deM+eng+BDEBUG+QPADEV000M 

Good web Skeleton – handles body onload

    1.00  50222<?xml version=”1.0″ encoding=”UTF-8″?>
    2.00  50222<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
    3.00  80618<!– LANSA for the Web – Skeleton Layout for MNU                    –>
    4.00  50222<!– Process         : %PR        %PRDS                             –>
    5.00  50222<!– Function        : %FU        %FUDS                             –>
    6.00  50222<!– Page            : %PG                                          –>
    7.00  50222<!– Generated by    : %PROD                                        –>
    8.00  50222<!– Created by user : %USERI                                       –>
    9.00  50222<!– Time and Date   : %STAMP                                       –>
   10.00  50222<!– RDML function sequence number – %SEQ                           –>
   11.00  50222<!– This is a *WEBEVENT function   %IFWEV                          –>
   12.00  50222<head>
   13.00  80522<!– Put Function Specific JS infront of Base JS                    –>
   14.00  80618<RDML COMPONENT=”PAG_MNUSKLHEAD”>
   15.00  80521<!– Title put in skeleton for base and function components         –>
   16.00  80521<TITLE><RDML MERGE=”&FUNCTION”> </TITLE>
   17.00  50222</head>
   18.00  80620<body <RDML COMPONENT=”PAG_MNUSKLBODYONLOAD”>>
   19.00  50222<!– ======================= LANSA Form Begins ======================== –>
   20.00  50222%W3FRM
   21.00  50222<!– Default hidden or process hidden –>
   22.00  50222<RDML MERGE=”&HIDDEN”>
   23.00  50222<!– ==================  Hidden Fields in the Request Group =========== –>
   24.00  80623<table border=”0″ cellpadding=”0″ cellspacing=”0″>
   25.00  50222%W3FLD
   26.00  50222</table>
   27.00  50222<!– ======================  End of Hidden fields   ===================  –>
   28.00  50222<!– =============================================== ==================  –>
   29.00  50222<!– =========================  Layout Begins Here   ==================  –>
   30.00  80618<RDML COMPONENT=”PAG_MNUSKLLAYOUT”>
   31.00  50222<!– =========================  Layout Ends Here   ====================  –>
   32.00  50222<!– =============================================== ==================  –>
   33.00  50222<!– ==========================  Browse List contents Start ===========  –>
   34.00  50222%W3BRW
   35.00  50222<!– ==========================  Browse List contents End  ============  –>
   36.00  50222</form>
   37.00  50222<!– ============================  LANSA Form Ends Here  ==============  –>
   38.00  50222</body>
   39.00  50222</html>


LANSA Handle Event with Debug Prompt

function mmHandleEvent(Proc,Func)
{
  var dbugDEV = prompt( "Enter Device Name for Debug Else leave blank"  );
  if(dbugDEV!="" )  document.LANSA.action+="+BDEBUG+"+dbugDEV+"+%20";
	   document.LANSA._PROCESS.value=Proc;
	   document.LANSA._FUNCTION.value=Func;
	   document.LANSA.submit();
}
LANSA JOBS
877 526 7220

LANSA Checkboxes in Expandable List

Must have _BLNAME before List and _BLEND at end. (1 underscore)

<input type=”hidden” name=”__ZZCHKUSER-<RDML MERGE=”&ROWNUM” FORMAT=4> D” value=”<RDML MERGE=”ZZCHKUSER”>” size=”1″ > (2 underscores )

This works. Field ZZCHKUSER is in Browselist that has *NOBICP

<input type=”hidden” name=”__ZZCHKUSER-<RDML MERGE=”&ROWNUM” FORMAT=4> D” value=”<RDML MERGE=”ZZCHKUSER”>” size=”1″ >

<input type=checkbox name=”mChkBoxQ<RDML MERGE=”LISTCOUNT”>” value=”” <RDML MERGE=ZZCHKNODE> onclick=”SetCBState(this, ‘__ZZCHKUSER-<RDML MERGE=”&ROWNUM” FORMAT=4> D’, ‘Y’, ‘N’)”></strong></td>

This is the stuff for the page component

<INPUT TYPE=”HIDDEN” NAME=”_BLNAME” VALUE=”X1BL01LST” SIZE=”10″>
<RDML MERGE=”&BLX1BL01LST”>
<INPUT TYPE=”HIDDEN” NAME=”_BLEND” VALUE=”X1BL01LST” SIZE=10>

This is the stuff for the list component

<!– Component START for B1ABSLST / MAM20080528 –>
<tr height=”20″ class='<RDML MERGE=”ZTRCOLOR”>’ >
<td align=”left”>
<A href=”JavaScript:document.LANSA.PLISTENTRY.value = ‘<RDML MERGE=”LISTCOUNT”>’; HandleEvent(‘<RDML MERGE=”*PROCESS”>’,'<RDML MERGE=”*FUNCTION”>’);”> <IMG src=”/IMAGES/ball_blue.gif” ALT=”Go To Account Bill Maintenance” BORDER=”0″></A>
<strong><RDML MERGE=”ZZNAM”></strong></td>
<td align=”left” class=”arial1blackbold”>  <strong> <RDML MERGE=”ZZACT”></strong></td>
<td align=”left” class=”arial1blackbold”><center>   <strong><RDML MERGE=”ZZCNT”></strong></center></td>
<td align=”right” class=”arial1blackbold”> <strong><input type=checkbox name=”mChkBoxL<RDML MERGE=”LISTCOUNT”>” value=”” <RDML MERGE=ZZCHKNODE> onclick=”blueBallsChk(this,<RDML MERGE=”LISTCOUNT”>)”></strong></td>
<td align=”right” class=”arial1blackbold”> <strong>

<input type=”hidden” name=”__ZZCHKUSER-<RDML MERGE=”&ROWNUM” FORMAT=4> D” value=”<RDML MERGE=”ZZCHKUSER”>” size=”1″ >

<input type=checkbox name=”mChkBoxQ<RDML MERGE=”LISTCOUNT”>” value=”” <RDML MERGE=ZZCHKNODE> onclick=”SetCBState(this, ‘__ZZCHKUSER-<RDML MERGE=”&ROWNUM” FORMAT=4> D’, ‘Y’, ‘N’)”></strong></td>
</tr>
<!– Component END for B1ABSLST / MAM20080506 –>

CALL me for LANSA jobs

Mark

877 526 7220

Using Checkboxes in a LANSA Browse list

If you want to use checkboxes in browse lists with their initial set checked, you will need to deploy the following technique. This technique is based on the preceding example.

<input type=”hidden” name=”__{field name}-<RDML MERGE=”&ROWNUM” FORMAT=4> D”

value=”<RDML MERGE=”{field name}” size=”{size}”>” />

<input type=”checkbox” name=”DUMMY” value=”<RDML MERGE=”{field name}”>”

onclick=”SetCBState(this, ‘__{field name}-<RDML MERGE=”&ROWNUM”

FORMAT=4> D’, ‘Y’, ‘N’)”

<RDML ONCONDITION=”{field name}”>

checked=”checked”

</RDML>

/>

{field name} is the name of the field you have defined in your DEF_LIST command. This {field name} is padded with trailing blanks to 10 characters.

Note that this technique uses the <RDML ONCONDITION> tag to determine the initial state of the checkbox.

This technique calls a different JavaScript function, SetCBState:

function SetCBState(obj, RFld, CY, CN)

{

var NumElements=document.LANSA.elements.length;

for (i=0; i<NumElements;i++)

{

if (document.LANSA.elements[i].name==RFld)

{

if (obj.checked) document.LANSA.elements[i].value=CY

else document.LANSA.elements[i].value=CN;

break;

}

}

}

Visual LANSA Editor Short Cuts

Position the current line on the top of the window Ctrl + T

Position the current line in the middle of the window Ctrl + M

Position the current line on the bottom of the window Ctrl + B

Toggle a tag on a line Ctrl + F2

Remove all tags Alt + F2

Jump to the previous tagged line Ctrl + Up Arrow

Jump to the next tagged line Ctrl + Down Arrow

Comment selected text Ctrl + W

Uncomment selected text Ctrl + Shift + W

Collapse blocks. This command blocks a level at a time.
If you keep collapsing the blocks, the entire code will
be collapsed, except for lines that are not in blocks. Ctrl + F9

Expand blocks. This command expands a level at the time Ctrl +F10

Collapse the block containing the line that has the focus Ctrl + Shift + F9

Expand the collapsed block that has the editor focus Ctrl + Shift + F10

Makes selection/next character upper case Alt + UpArrow

Makes selection/next character lower case Alt + DownArrow

Delete word right Ctrl + Delete

Delete word left Ctrl + BackSpace

Delete from current position to end of line Alt + Shift + L

Cut line and place it on clipboard Ctrl + L

Copy line and place it on clipboard Alt + Q

Copy selection or line Plus key in number pad

Copy selected text to the clipboard Ctrl + Insert

Paste text from the clipboard Shift + Insert

Copy selected text to the clipboard Ctrl + C

Cut selected text to the clipboard Ctrl + X

Paste text from the clipboard Ctrl + V

Extend/reduce selection to next part of statement Ctrl + Shift + RightArrow

Extend/reduce selection to start of previous part of statement Ctrl + Shift + LeftArrow

Block select to end of line Shift + End

Block select to start of line Shift + Home

Block select to start of file Ctrl + Shift + Home

Block select to end of file Ctrl + Shift + End

Block select to page down Shift + PageDown

Block select to page up Shift + PageUp

Block select part of statement Left Button double-click

Line selection Shift + UpArrow

Line selection Shift + DownArrow

Select all text Ctrl + A

Find text Ctrl + F

Replace text Ctrl + H

Find next F3

Find previous Shift + F3

Go to line Ctrl + G

The only reference to *NOBCIPT on the web, courtesy of Mark Mason

*Noxxxxx

 

The contents of this variable allows you to disable:

·         Borders around the browse list.

·         Column headings.

·         Selection image.

·         Borders around empty cells in the browse list.

To turn off any of the above features, you will need to define the variable as a Text variable. The content of the variable is then set to be:

*Noxxxxx

where xxxxx can be up to five characters, identifying the feature to disable.

If you want to disable the border around the browse list, specify a ‘B’ character.

If you want to disable the column heading in the browse list, specify a ‘C’ character.

If you want to disable the selection image, specify an ‘I’ character.

If you do not want a <table> HTML tag around your browse list, specify a ‘T’ character.

If you do not want borders displayed around empty cells in your browse list, specify a ‘P’ character.

Note that if you disable the selection image, none of the columns in the browse list will be hyperlinked, even though you have enabled LANSA for the Web to allow selection from any column in a browse list. For example, *NOB would switch borders off.