Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

highlight row in JSP not working ??

4 views
Skip to first unread message

alim

unread,
May 25, 2007, 4:15:22โ€ฏAM5/25/07
to
hi gurus,
I want to used highlight row in datawindow. Example I had 2 column and
the column name is : Number, Description. When I click the datawindow
in row 2 or 3 is not effect for hightlight row. I tried to used
dw_1.selectrow(0,false); and dw_1.selectrow(row,true);

I put into:
<script language="javascript">
function dw_1.clicked(row,objname)
dw_1.selectrow(0,false);
dw_1.selectrow(row,true);

</script>

but when I tried in POWERBUILDER is working. Why in JSP is not
working ?

please help me.

thank you.

best regards,

alim

Dean Jones

unread,
May 25, 2007, 9:04:41โ€ฏAM5/25/07
to
You need to write your own Javascript to handle it client side. It depends
on what version of PB you are running. It does not use a powerbuilder
function.

--
Dean Jones
CEO
PowerObjects
http://www.powerobjects.com
(612) 339-3355 Ext. 112

TeamSybase
* * Think Sybase * *


"alim" <alfe...@yahoo.com> wrote in message
news:1180080922.0...@b40g2000prd.googlegroups.com...

Rahul Jain

unread,
May 25, 2007, 9:31:01โ€ฏAM5/25/07
to
You can try this if you are using PB version < 10.2:

<script>
var ls_rowElement

function highlightRow (as_rowElement)
{
as_rowElement.style.background = "#99ccff";

}

function htmldw_Clicked ( row, obj )
{
ls_rowElement = event.srcElement.parentElement.parentElement;
highlightRow (as_rowElement)
}


</script>

It is much better with >= 10.2 - as Dean mentioned, you get ID attribute on
row DIV. So you can get handle to row easily and highlight it.


HTH
--
Rahul Jain


"alim" <alfe...@yahoo.com> wrote in message
news:1180080922.0...@b40g2000prd.googlegroups.com...

alim

unread,
May 27, 2007, 10:31:58โ€ฏPM5/27/07
to
Hi rahul,

I tried your scripts had error..."as_rowElement undefined"......I
change var as_rowElement still not working..as below:
<SCRIPT language="JavaScript">
var ls_rowElement


function highlightRow (as_rowElement)
{
var as_rowElement=event.srcElement.parentElement.parentElement
as_rowElement.style.background = "#99ccff";

}


function webDW_1_Clicked ( row, obj )
{
ls_rowElement = event.srcElement.parentElement.parentElement;
highlightRow (ls_rowElement)


}
</SCRIPT>

By the way, do you had sample please send to my email :
alfe...@yahoo.com

note: PB 10. EASSERVER 5.2.0

best regards,

alim


Rahul Jain menuliskan:

Adam Simmonds [TeamSybase]

unread,
May 27, 2007, 11:37:57โ€ฏPM5/27/07
to
alim wrote:
> Hi rahul,
>
> I tried your scripts had error..."as_rowElement undefined"......I
> change var as_rowElement still not working..as below:

Do you have the options on the DW to generate JS, client events and
client scriptable? I would think you need these as a minimum.

a.

alim

unread,
May 28, 2007, 12:30:41โ€ฏAM5/28/07
to
hi adam,
In where I must to had the options on the DW ? can you give me step by
steps..because this first I tried PB TO WEB. If do you had example for
this case please send to my email : alfe...@yahoo.com

Best regards,

alim

Adam Simmonds [TeamSybase] menuliskan:

Adam Simmonds [TeamSybase]

unread,
May 28, 2007, 12:49:13โ€ฏAM5/28/07
to
alim wrote:
> hi adam,
> In where I must to had the options on the DW ? can you give me step by
> steps..because this first I tried PB TO WEB. If do you had example for
> this case please send to my email : alfe...@yahoo.com

I never use email. The discussions are best kept on the newsgroups so
that any possibly solutions can be viewed by others.

If you open a datawindow and go to the Web Generation tab you will see
the options I am referring to.

a.

alim

unread,
May 28, 2007, 1:39:11โ€ฏAM5/28/07
to

hi adam,
I already turn on for WEB GENERATION as below:
1. Generate JavaScript
2. Client events.
3. Client Validation
4. Client Computed Fields
5. Client Formatting.
6. Client Scriptable

but still same problem.

best regards,
alim


On May 28, 11:30 am, alim <alfen_...@yahoo.com> wrote:
> hi adam,
> In where I must to had the options on the DW ? can you give me step by
> steps..because this first I tried PB TO WEB. If do you had example for

> this case please send to my email : alfen_...@yahoo.com


>
> Best regards,
>
> alim
>
> Adam Simmonds [TeamSybase] menuliskan:
>
>
>
> > alim wrote:
> > > Hi rahul,
>
> > > I tried your scripts had error..."as_rowElement undefined"......I
> > > change var as_rowElement still not working..as below:
>
> > Do you have the options on the DW to generate JS, client events and
> > client scriptable? I would think you need these as a minimum.
>
> > a.
>
> > > <SCRIPT language="JavaScript">
> > > var ls_rowElement
>
> > > function highlightRow (as_rowElement)
> > > {
> > > var as_rowElement=event.srcElement.parentElement.parentElement
> > > as_rowElement.style.background = "#99ccff";
>
> > > }
>
> > > function webDW_1_Clicked ( row, obj )
> > > {
> > > ls_rowElement = event.srcElement.parentElement.parentElement;
> > > highlightRow (ls_rowElement)
>
> > > }
> > > </SCRIPT>
>
> > > By the way, do you had sample please send to my email :

> > > alfen_...@yahoo.com


>
> > > note: PB 10. EASSERVER 5.2.0
>
> > > best regards,
>
> > > alim
>
> > > Rahul Jain menuliskan:
> > >> You can try this if you are using PB version < 10.2:
>
> > >> <script>
> > >> var ls_rowElement
>
> > >> function highlightRow (as_rowElement)
> > >> {
> > >> as_rowElement.style.background = "#99ccff";
>
> > >> }
>
> > >> function htmldw_Clicked ( row, obj )
> > >> {
> > >> ls_rowElement = event.srcElement.parentElement.parentElement;
> > >> highlightRow (as_rowElement)
> > >> }
>
> > >> </script>
>
> > >> It is much better with >= 10.2 - as Dean mentioned, you get ID attribute on
> > >> row DIV. So you can get handle to row easily and highlight it.
>
> > >> HTH
> > >> --
> > >> Rahul Jain
>

> > >> "alim" <alfen_...@yahoo.com> wrote in message


> > >>news:1180080922.0...@b40g2000prd.googlegroups.com...
> > >>> hi gurus,
> > >>> I want to used highlight row in datawindow. Example I had 2 column and
> > >>> the column name is : Number, Description. When I click the datawindow
> > >>> in row 2 or 3 is not effect for hightlight row. I tried to used
> > >>> dw_1.selectrow(0,false); and dw_1.selectrow(row,true);
>
> > >>> I put into:
> > >>> <script language="javascript">
> > >>> function dw_1.clicked(row,objname)
> > >>> dw_1.selectrow(0,false);
> > >>> dw_1.selectrow(row,true);
>
> > >>> </script>
>
> > >>> but when I tried in POWERBUILDER is working. Why in JSP is not
> > >>> working ?
>
> > >>> please help me.
>
> > >>> thank you.
>
> > >>> best regards,
>

> > >>> alim- Hide quoted text -
>
> - Show quoted text -


Adam Simmonds [TeamSybase]

unread,
May 28, 2007, 2:13:34โ€ฏAM5/28/07
to
alim wrote:
> hi adam,
> I already turn on for WEB GENERATION as below:
> 1. Generate JavaScript
> 2. Client events.
> 3. Client Validation
> 4. Client Computed Fields
> 5. Client Formatting.
> 6. Client Scriptable
>
> but still same problem.

I think the problem is in the code Rahul provided
He has ls_rowElement and as_rowElement.
Change the as_rowElement to ls_rowElement and see if that works.
Probably best to have a check to see if the object is valid before
trying to highlight it.

Code should be like this

function htmldw_Clicked ( row, obj )
{
ls_rowElement = event.srcElement.parentElement.parentElement;

highlightRow (ls_rowElement)
}

a.

alim

unread,
May 28, 2007, 3:02:24โ€ฏAM5/28/07
to
Hi adam,

I tried this script as below (but still not working):
<%@ page import="com.sybase.powerbuilder.jspobject.*" %><%
// global instance for the page
PSDocumentClass psDocument = new PSDocumentClass(request, response,
out, application);
PSSessionClass psSession = new PSSessionClass(session);
PSServerClass psServer = new PSServerClass(psDocument);
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="PowerSiteData" NAME="SERVERLANGUAGE"
CONTENT="Java">
<TITLE>test3</TITLE>
<META http-equiv="Content-Type" content="text/html;
charset=utf-8">
<META content="PB10.0.0.4510" name="GENERATOR">
</HEAD>
<BODY language="JavaScript" bgColor="white" onload="" PSPARAMS="">
&nbsp;

<%
{
PSJaguarConnection jagConn = new PSJaguarConnection("cs-alim",
"DataWindow/HTMLGenerator100", false);
PSDataWindowSourceClass dwSource = new PSDataWindowSourceClass("D:/
ALIM/website PB COOL/alfen/EASStarterKit9/easstarterkit9.pbl",
"d_test", false);
PSConnectionParmsClass dbConn = new
PSConnectionParmsClass("Easstarterkit9", true);
PSDataWindowClass webDW = new PSDataWindowClass(pageContext, request,
"webDW_1", false, jagConn, dwSource, dbConn, 0);
webDW.SetWeight(true, true, true, true, true);

webDW.Generate();
}
%>
<!-- This script code is automatically generated - do not modify! -->


<SCRIPT language="JavaScript">
var ls_rowElement


function highlightRow (ls_rowElement)
{
//var as_rowElement=event.srcElement.parentElement.parentElement
ls_rowElement.style.background = "#99ccff";

}


function webDW_1_Clicked ( row, objName )


{
ls_rowElement = event.srcElement.parentElement.parentElement;
highlightRow (ls_rowElement)


}
</SCRIPT>

&nbsp;
<P>&nbsp;</P>
</BODY>
</HTML>


but still same not working.

On May 28, 1:13 pm, "Adam Simmonds [TeamSybase]"

> >> - Show quoted text -- Hide quoted text -

Rahul Jain

unread,
May 28, 2007, 11:37:30โ€ฏPM5/28/07
to
Can you attach the HTML source? It's been so long that I looked at it.
Since you are using PB 10, the script can be much easier. Please send
me the source and I will write up a script for you.

Rahul Jain


On May 28, 3:02 am, alim <alfen_...@yahoo.com> wrote:
> Hi adam,
>
> I tried this script as below (but still not working):
> <%@ page import="com.sybase.powerbuilder.jspobject.*" %><%
> // global instance for the page
> PSDocumentClass psDocument = new PSDocumentClass(request, response,
> out, application);
> PSSessionClass psSession = new PSSessionClass(session);
> PSServerClass psServer = new PSServerClass(psDocument);
> %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML>
> <HEAD>
> <META HTTP-EQUIV="PowerSiteData" NAME="SERVERLANGUAGE"
> CONTENT="Java">
> <TITLE>test3</TITLE>
> <META http-equiv="Content-Type" content="text/html;
> charset=utf-8">
> <META content="PB10.0.0.4510" name="GENERATOR">
> </HEAD>
> <BODY language="JavaScript" bgColor="white" onload="" PSPARAMS="">
>

> <%
> {
> PSJaguarConnection jagConn = new PSJaguarConnection("cs-alim",
> "DataWindow/HTMLGenerator100", false);
> PSDataWindowSourceClass dwSource = new PSDataWindowSourceClass("D:/
> ALIM/website PB COOL/alfen/EASStarterKit9/easstarterkit9.pbl",
> "d_test", false);
> PSConnectionParmsClass dbConn = new
> PSConnectionParmsClass("Easstarterkit9", true);
> PSDataWindowClass webDW = new PSDataWindowClass(pageContext, request,
> "webDW_1", false, jagConn, dwSource, dbConn, 0);
> webDW.SetWeight(true, true, true, true, true);
>
> webDW.Generate();}
>
> %>
> <!-- This script code is automatically generated - do not modify! -->
> <SCRIPT language="JavaScript">
> var ls_rowElement
>
> function highlightRow (ls_rowElement)
> {
> //var as_rowElement=event.srcElement.parentElement.parentElement
> ls_rowElement.style.background = "#99ccff";
>
> }
>
> function webDW_1_Clicked ( row, objName )
> {
> ls_rowElement = event.srcElement.parentElement.parentElement;
> highlightRow (ls_rowElement)
>
> }
>
> </SCRIPT>
>
>

> <P> </P>

alim

unread,
May 29, 2007, 10:14:21โ€ฏPM5/29/07
to
hi Rahul,
I can not attachment file into this group. by the way, Can I email to
you ? if yes, please give me your email ? but I attachment as below
for source code :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="PowerSiteData" NAME="SERVERLANGUAGE"
CONTENT="Java">
<TITLE>test3</TITLE>
<META http-equiv="Content-Type" content="text/html;
charset=utf-8">
<META content="PB10.0.0.4510" name="GENERATOR">
</HEAD>
<BODY language="JavaScript" bgColor="white" onload=""

PSERRORSONPAGE="NONE" PSPARAMS="" PSSSEVTMODEL="">
&nbsp;
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT language="JavaScript" id="OBJECT1" height="75" width="403"
classid="clsid:AAAA9498-0000-4F8E-AD9F-5CABEF2002A3" name="webDW_1"
Create='


PSJaguarConnection jagConn = new PSJaguarConnection("cs-alim",
"DataWindow/HTMLGenerator100", false);
PSDataWindowSourceClass dwSource = new PSDataWindowSourceClass("D:/
ALIM/website PB COOL/alfen/EASStarterKit9/easstarterkit9.pbl",
"d_test", false);
PSConnectionParmsClass dbConn = new
PSConnectionParmsClass("Easstarterkit9", true);

PSWebDataWindowClass webDW = new PSWebDataWindowClass(this, name,


false, jagConn, dwSource, dbConn, 0);
webDW.SetWeight(true, true, true, true, true);

webDW.bAutomaticRetrieve = true;
return webDW;' PSSERVERSCRIPTABLE="true" Clicked=" ls_rowElement =
event.srcElement.parentElement.parentElement;
highlightRow (as_rowElement)
">
<PARAM NAME="_cx" VALUE="10663"></PARAM>
<PARAM NAME="_cy" VALUE="1984"></PARAM>
<PARAM NAME="SourceFileName" VALUE="D:\ALIM\website PB COOL\alfen
\EASStarterKit9\easstarterkit9.pbl"></PARAM>
<PARAM NAME="DataWindowObject" VALUE="d_test"></PARAM>
<PARAM NAME="StandaloneDataWindow" VALUE=""></PARAM>
<PARAM NAME="AbsoluteLibPath" VALUE="1"></PARAM>
<PARAM NAME="DataConnection" VALUE="Easstarterkit9"></PARAM>
<PARAM NAME="EnableWeightSettings" VALUE="1"></PARAM>
<PARAM NAME="EnableNameOverride" VALUE="1"></PARAM>
<PARAM NAME="EnableRowsOverride" VALUE="0"></PARAM>
<PARAM NAME="AllowDataEntry" VALUE="1"></PARAM>
<PARAM NAME="Events" VALUE="1"></PARAM>
<PARAM NAME="Validation" VALUE="1"></PARAM>
<PARAM NAME="Formatting" VALUE="1"></PARAM>
<PARAM NAME="Scripting" VALUE="1"></PARAM>
<PARAM NAME="ServerStateManagement" VALUE="0"></PARAM>
<PARAM NAME="Name" VALUE="webDW_1"></PARAM>
<PARAM NAME="PageSize" VALUE="0"></PARAM>
<PARAM NAME="AutoRetrieve" VALUE="1"></PARAM>
<PARAM NAME="RetrievalArgNames" VALUE=""></PARAM>
<PARAM NAME="RetrievalArgValues" VALUE=""></PARAM>
<PARAM NAME="PageParameters" VALUE=""></PARAM>
<PARAM NAME="LinkObjects" VALUE=",,,,,"></PARAM>
<PARAM NAME="ColumnLink" VALUE=",,,,,"></PARAM>
<PARAM NAME="ColumnLinkTarget" VALUE=",,,,,"></PARAM>
<PARAM NAME="ServerName" VALUE="cs-alim:9000"></PARAM>
<PARAM NAME="UserID" VALUE="jagadmin"></PARAM>
<PARAM NAME="Passwd" VALUE=""></PARAM>
<PARAM NAME="ComponentName" VALUE="DataWindow/HTMLGenerator100"></
PARAM>
<PARAM NAME="OneTrip" VALUE="0"></PARAM>
<PARAM NAME="EnableJaguar" VALUE="1"></PARAM>
<PARAM NAME="ProfileName" VALUE="cs-alim"></PARAM>
<PARAM NAME="SourceType" VALUE="2"></PARAM>
<PARAM NAME="Target" VALUE="JSPTarget"></PARAM>
<PARAM NAME="Generate" VALUE="0"></PARAM>

</OBJECT>
-->
<%

psPage.webDW_1.Generate();


%>
<!-- This script code is automatically generated - do not modify! -->
<SCRIPT language="JavaScript">
var ls_rowElement

function highlightRow (as_rowElement)
{
as_rowElement.style.background = "#99ccff";

}

function webDW_1_Clicked(row, objectName)


{
ls_rowElement = event.srcElement.parentElement.parentElement;
highlightRow (as_rowElement)

}

</SCRIPT>
<!--METADATA TYPE="DesignerControl" endspan-->


&nbsp;
<P>&nbsp;</P>
</BODY>
</HTML>

thank you for your advice before.

best regards,

alim

best regards,

alim

Rahul Jain

unread,
May 30, 2007, 2:06:34โ€ฏPM5/30/07
to
Sure... send it via email - remove Xs from my email ID. I do not need the
JSP source, I need the HTML source (View Source from your browser).

Rahul


"alim" <alfe...@yahoo.com> wrote in message

news:1180491261.5...@q19g2000prn.googlegroups.com...

alim

unread,
May 30, 2007, 11:34:55โ€ฏPM5/30/07
to
hi rahul,
Oke..I cannot send it via email. by the way,I view source from
browsing as below :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="PowerSiteData" NAME="SERVERLANGUAGE"
CONTENT="Java">
<TITLE>test3</TITLE>
<META http-equiv="Content-Type" content="text/html;
charset=utf-8">
<META content="PB10.0.0.4510" name="GENERATOR">
</HEAD>

<BODY language="JavaScript" bgColor="white" onload="psPage.OnLoad();"
PSERRORSONPAGE="NONE"><FORM NAME="__submitForm" METHOD="POST"
ACTION="test3.jsp">
<INPUT TYPE="hidden" NAME="__ActionControlName" VALUE="">
<INPUT TYPE="hidden" NAME="__GeneratedFromPage" VALUE="test3.jsp">
<INPUT TYPE="hidden" NAME="webDW_1_context" VALUE="" >
<INPUT TYPE="hidden" NAME="webDW_1_action" VALUE="" >
</FORM>
<SCRIPT LANGUAGE="JavaScript">
function __submitForm_onSubmit(submitForm) {
// Generate some kind of user defined client side OnSubmit???
// check if Web DW caused submit
if (psPage.webDW_1.action != "") {
submitForm.webDW_1_action.value = psPage.webDW_1.action;
submitForm.__ActionControlName.value = "webDW_1";
}
submitForm.webDW_1_context.value = psPage.webDW_1.GetFullContext();
return true;
}
var psPage = new Object();
psPage.submitForm = document.__submitForm;

function psPage___ButtonPress(buttonName) {
this.submitForm.__ActionControlName.value = buttonName;
this.Submit();
}
function psPage___Submit() {
if(__submitForm_onSubmit(this.submitForm))
this.submitForm.submit();
}
psPage.ButtonPress = psPage___ButtonPress;
psPage.Submit = psPage___Submit;
</SCRIPT>
<FORM LANGUAGE="JavaScript" NAME="__dataForm" ACTION="don't submit
this form" OnSubmit="psPage.Submit(); return false;">

&nbsp;

<STYLE TYPE="text/css">
<!--
.webDW-1197{;background-color:transparent; width:100%}
.webDW-1198{;background-color:transparent}
.webDW-1199{;background-color:transparent;COLOR:#000000;FONT:10pt
"Tahoma", sans-serif;FONT-STYLE:normal;FONT-WEIGHT:normal;TEXT-
DECORATION:none;TEXT-ALIGN:center;BORDER-STYLE:none}
.webDW-119D{;background-color:#ffffff; width:100%;COLOR:#000000;FONT:
10pt "Tahoma", sans-serif;FONT-STYLE:normal;FONT-WEIGHT:normal;TEXT-
DECORATION:none;TEXT-ALIGN:right;BORDER-STYLE:inset}
.webDW-119E{;background-color:#ffffff; width:100%;COLOR:#000000;FONT:
10pt "Tahoma", sans-serif;FONT-STYLE:normal;FONT-WEIGHT:normal;TEXT-
DECORATION:none;TEXT-ALIGN:left;BORDER-STYLE:none}
.webDW-119F{;background-color:transparent;COLOR:#000000;FONT:10pt
"Tahoma", sans-serif;FONT-STYLE:normal;FONT-WEIGHT:normal;TEXT-
DECORATION:none;TEXT-ALIGN:right;BORDER-STYLE:none}
.webDW-11A1{;background-color:#ffffff; width:100%;COLOR:#000000;FONT:
10pt "Tahoma", sans-serif;FONT-STYLE:normal;FONT-WEIGHT:normal;TEXT-
DECORATION:none;TEXT-ALIGN:right;BORDER-STYLE:none}
-->
</STYLE>

<SCRIPT LANGUAGE="JavaScript">

//
**************************************************************************
// Copyright Sybase, Inc. 1998-2004
// All Rights reserved.
//
// Sybase, Inc. ("Sybase") claims copyright in this
// program and documentation as an unpublished work, versions of
// which were first licensed on the date indicated in the foregoing
// notice. Claim of copyright does not imply waiver of Sybase's
// other rights.
//
// This code is generated by the PowerBuilder HTML DataWindow
generator.
// It is provided subject to the terms of the Sybase License
Agreement
// for use as is, without alteration or modification.
// Sybase shall have no obligation to provide support or error
correction
// services with respect to any altered or modified versions of this
code.
//
// ***********************************************************
// ** DO NOT MODIFY OR ALTER THIS CODE IN ANY WAY **
// ***********************************************************
//
//
***************************************************************
// ** IMPLEMENTATION DETAILS SUBJECT TO CHANGE WITHOUT NOTICE.
**
// ** DO NOT RELY ON IMPLEMENTATION!!!! **
//
***************************************************************
//
// Use the public interface only.
//
**************************************************************************

// these arrays will be filled with internationalized strings based on
the server
var DW_shortDayNames = new Array("Sun", "Mon", "Tues", "Wed", "Thurs",
"Fri", "Sat");
var DW_longDayNames = new Array("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday");
var DW_shortMonthNames = new Array("Jan", "Feb", "Mar", "Apr", "May",
"Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
var DW_longMonthNames = new Array("January", "Febuary", "March",
"April", "May", "June", "July", "August", "September", "October",
"November", "December");

// this is dependent on the control panel setting on the server
// it indicates the order of days (this is mm/dd/yyyy)
var DW_PARSEDT_monseq = 0;
var DW_PARSEDT_dayseq = 1;
var DW_PARSEDT_yearseq = 2;

// DWItemStatus
var DW_ITEMSTATUS_NOCHANGE = 0;
var DW_ITEMSTATUS_MODIFIED = 1;
var DW_ITEMSTATUS_NEW = 2;
var DW_ITEMSTATUS_NEW_MODIFIED = 3;

// Added to determine if dates are being processed in client side
JavaScript.
var bDateTimeProcessingEnabled = false;

var gMask = "";

// common utility functions

function escapeString( inString )
{
var index;
var outString = "";
var tempChar;

// force to string type or charAt will fail!
if (typeof inString != "string")
inString = inString.toString();

var strLength = inString.length;
for ( index=0; index < strLength; index++ )
{
tempChar = inString.charAt( index );
if (tempChar == "\"" || tempChar == "'")
outString += "~" + tempChar;
else if (tempChar == "\r")
outString += "~r";
else if (tempChar == "\n")
outString += "~n";
else
outString += tempChar;
}
return outString;
}

function convertToRGB( color )
{
var hexValue = "000000" + eval( color ).toString(16);
hexValue = hexValue.substr( hexValue.length - 6, 6 );
hexValue = hexValue.substr( 4, 2 ) + hexValue.substr( 2, 2 ) +
hexValue.substr( 0, 2 );
return hexValue;
}

// default event returns to 0
function _evtDefault (value)
{
if (value + "" == "undefined")
return 0;
return value;
}

// need to double up because of template expander!
function DW_parseIsSpace(theChar)
{
return /^\s$/.test(theChar);
}

function DW_parseIsDigit(theChar)
{
return /^\d$/.test(theChar);
}

function DW_parseIsAlpha(theChar)
{
return /^\w$/.test(theChar) && ! /^\d$/.test(theChar);
}

// auto binding of events expect <controlName>_<eventName>
function HTDW_eventImplemented(sEventName)
{
// check if we already have one scripted
if (this[sEventName] == null)
{
// check for function with default name
var testName = this.name + '_' + sEventName;
if (eval ('typeof ' + testName) == 'function')
this[sEventName] = eval(testName);
}

return this[sEventName] != null;
}

// utility functions
function allowInString (inString, refString)
{
var index, tempChar;
var strLength = inString.length;
for (index=0; index < strLength; index++)
{
tempChar= inString.charAt (index);
if (refString.indexOf (tempChar)==-1)
return false;
}
return true;
}

function DW_Trim(inString)
{
var indexStart, indexEnd, tempChar, outString;
var strLength = inString.length;
// skip leading blanks
for (indexStart=0; indexStart < strLength; indexStart++)
{
tempChar= inString.charAt (indexStart);
if (tempChar != " ")
break;
}
if (indexStart != strLength)
{
// skip trailing blanks
for (indexEnd=strLength-1; indexEnd > 0; indexEnd--)
{
tempChar= inString.charAt (indexEnd);
if (tempChar != " ")
break;
}
// get all chars in between
outString = inString.substring(indexStart, indexEnd+1);
}
else
outString = "";
return outString;
}

function DW_Round(num, decPlaces)
{
var powTen = Math.pow(10.0,decPlaces);
num *= powTen;
if (num >= 0)
num = Math.floor(num + 0.5);
else
num = Math.ceil(num - 0.5);

return num / powTen;
}

function DW_IsNonNegativeNumber(inString, bNilIsNull)
{
if (arguments.length < 2)
bNilIsNull = false;
if (inString == "")
return bNilIsNull;
else
{
var newString = DW_Trim(inString);
if (newString == "")
return false;
else
{
var result = new DW_NumberClass();
if(DW_parseNumberStringAgainstMask(inString, result, false))
{
if (result >= 0)
return true;
}

return false;
}
}
}

function DW_IsValidDisplayOrDataValue(inString, bNilIsNull)
{
if (arguments.length < 2)
bNilIsNull = false;
if (inString == "")
return bNilIsNull;
else
{
var i;
for(i = 0; i < this.displayValue.length; i++)
{
if (inString == this.displayValue[i])
return true;
if (inString == this.dataValue[i])
return true;
}
return false;
}
}

function DW_IsNumber(inString, bNilIsNull)
{
if (arguments.length < 2)
bNilIsNull = false;
if (inString == "")
return bNilIsNull;
else
{
var newString = DW_Trim(inString);
if (newString == "")
return false;
else
return DW_parseNumberStringAgainstMask(inString, null, true);
}
}

// exprContext class
function HTDW_exprContextClass(dataWindow)
{
this.dw = dataWindow;
this.row = -1;
this.currentText = "";
}

// Col0 class
function HTDW_Col0Class(rowId, dwItemStatus)
{
this.colModified = new Array();
this.rowId = rowId;
this.itemStatus = dwItemStatus;
}

// Row class
function HTDW_RowClass(rowId)
{
var col;

// column 0 holds special data
this[0] = new HTDW_Col0Class(rowId, arguments[1]);

// get data values
for (col = 1; col < arguments.length - 1; col++)
{
this[0].colModified[col] = false;
this[col] = arguments[col + 1];
}

this.numCols = arguments.length - 1;
}

function HTDW_Row_generateChange (rowNum, rowObj)
{
var col;
var result;

if (rowObj[0].itemStatus == DW_ITEMSTATUS_MODIFIED ||
rowObj[0].itemStatus == DW_ITEMSTATUS_NEW_MODIFIED)
{
result = "(ModifyRow " + rowNum + " " + rowObj[0].rowId +
" (";
for (col = 1; col < rowObj.numCols; col++)
{
if (rowObj[0].colModified[col])
{
if (rowObj[col] == null)
result += "(" + col + " 1)";
else
result += "(" + col + " 0 '" +
escapeString(rowObj[col]) + "')";
}
}
result += "))";
}
else
result = "";

return result;
}

function HTDW_Row_dumpRow (rowNum, rowObj)
{
var col;
var result;

result = "Row " + rowNum + "\n" +
"Modified:" + rowObj[0].itemStatus + "\n" +
"RowId:" + rowObj[0].rowId + "\n" +
"NumCols:" + (rowObj.numCols - 1) + "\n";

for (col = 1; col < rowObj.numCols; col++)
{
result += " Col " + col + " modified:" +
rowObj[0].colModified[col] + " '" + rowObj[col] + "'\n";
}

// alert (result);

return result;
}

// set up class functions
HTDW_RowClass.generateChange = HTDW_Row_generateChange;
HTDW_RowClass.dumpRow = HTDW_Row_dumpRow;

function HTDW_ColumnGob(name, colNum, rowInDetail, region, bRequired,
bNilIsNull, bFocusRect, formatFunc, getDisplayFormatFunc,
getEditFormatFunc, column)
{
this.name = name;
this.colNum = colNum;
this.rowInDetail = rowInDetail;
this.region = region;
this.bRequired = bRequired;
this.bNilIsNull = bNilIsNull;
this.bFocusRect = bFocusRect;
this.bUseCodeTable = false;

this.getDisplayFormat = getDisplayFormatFunc;
this.getEditFormat = getEditFormatFunc;
this.format = formatFunc;
this.column = column;
}

function HTDW_ComputeGob(name, region, computeFunc, formatFunc,
getDisplayFormatFunc)
{
this.name = name;
this.region = region;

this.compute = computeFunc;
this.getDisplayFormat = getDisplayFormatFunc;
this.format = formatFunc;
}

// Depend classes common function
// DependCompute class
function HTDW_DependComputeUpdate(htmlDw, row, bSkipCurrent)
{
var gob = this.gob;
var control = htmlDw.findControl(gob.name, row, gob.region == 0);

if (control != null && typeof gob.compute == "function")
{
// body
if (gob.region == 0)
row = row;
// header
else if (gob.region == 1)
row = htmlDw.firstRow;
// footer or summary
else if (gob.region == 2 || gob.region == 3)
row = htmlDw.lastRow;

var exprCtx = htmlDw.exprCtx;
exprCtx.row = row;
exprCtx.currentText = "";

var value = gob.compute(exprCtx);

if (control.type == "hidden" || control.type == "password" ||
control.type == "text" || control.type == "textarea")
{
var displayValue;
if (gob.format != null && gob.getDisplayFormat != null)
{
var formatString;
if (typeof gob.getDisplayFormat == "string")
formatString = gob.getDisplayFormat;
else
formatString = gob.getDisplayFormat (exprCtx);
displayValue = gob.format (formatString, value,
control);
}
else if (value != null)
displayValue = value.toString();
else
displayValue = "";
control.value = displayValue;
}
}
}

function HTDW_DependCompute(gob)
{
this.gob = gob;

this.update = HTDW_DependComputeUpdate;
}

// DependColumn class
function HTDW_DependColumnUpdate(htmlDw, row, bSkipCurrent)
{
var gob = this.gob;
var control = htmlDw.findControl(gob.name, row, gob.region == 0);

// don't mess with the current control if asked not to
if (control != null &&
! (bSkipCurrent && control == htmlDw.currentControl))
{
// body
if (gob.region == 0)
row = row + gob.rowInDetail;
// header
else if (gob.region == 1)
row = htmlDw.firstRow;
// footer or summary
else if (gob.region == 2 || gob.region == 3)
row = htmlDw.lastRow;

var value = htmlDw.rows[row][gob.colNum];

if (control.type == "hidden" || control.type == "password" ||
control.type == "text" || control.type == "textarea" ||
control.type == "select-one")
{
var displayValue;
if (gob.format != null && gob.getDisplayFormat != null)
{
var exprCtx = htmlDw.exprCtx;
exprCtx.row = row;
exprCtx.currentText = "";
if (typeof gob.getDisplayFormat == "string")
formatString = gob.getDisplayFormat;
else
formatString = gob.getDisplayFormat (exprCtx);
displayValue = gob.format (formatString, value,
control);
}
else if (value != null)
displayValue = value.toString();
else
displayValue = "";
control.value = displayValue;
}
else if(control.type == "checkbox")
{
if (value != null)
{
var displayValue;
displayValue = value.toString();
if ( (control.checked==true) && (displayValue!
=control.value.toString()))
control.checked=false;
else if ((control.checked==false) && (displayValue!
=control.value.toString()))
control.checked=true;

control.value = displayValue;
}
}

else if(control.length>1)
if(control[0].type="radio")
{
var r;
for (r=0;r<control.length;r++)
{
displayValue = value.toString();
if(control[r].value==displayValue)
{
control[r].checked=true;
}

}

}

}
}

function HTDW_DependColumn(gob)
{
this.gob = gob;

this.update = HTDW_DependColumnUpdate;
}

// Column class
function HTDW_Column_addDepend(depend)
{
if (this.dependents == null)
this.dependents = new Array();

this.dependents[this.dependents.length] = depend;
}

function HTDW_Column_updateDependents(htmlDw, row, bSkipCurrent)
{
if (this.dependents != null)
{
for (var i=0; i < this.dependents.length; ++i)
this.dependents[i].update (htmlDw, row, bSkipCurrent);
}
}

function HTDW_ColumnClass(colId, name, convertFromStringFunc,
typeValidationFunc, itemValidateFunc, validationMessageFunc,
computeFunc, displayGobName)
{
this.colId = colId;
this.name = name;
this.dependents = null;

this.convertFromString = convertFromStringFunc;
this.validateByType = typeValidationFunc;
this.validateItem = itemValidateFunc;
this.validationError = validationMessageFunc;
this.compute = computeFunc;
this.displayGobName = displayGobName;

// interface functions
this.addDepend = HTDW_Column_addDepend;
this.updateDependents = HTDW_Column_updateDependents;

this.displayValue = new Array();
this.dataValue = new Array()
}

// DataWindow class
function HTDW_findControl(gobName, row, bInBody)
{
var control = null;
var controlExists;
var controlName = gobName;
var controlObject;

if (bInBody)
controlName += "_" + row;

if (this.dataForm + "" != "undefined")
{
controlObject = 'this.dataForm.' + controlName;
controlExists = eval('typeof ' + controlObject);
if (controlExists == "object")
control = eval(controlObject);
}
else if (this.navLayerForms[0] + "" != "undefined") // try array
of Netscape layered forms
{
var rowObj = this.rows[row];
var index = 0;
if (bInBody)
index = row * (rowObj.numCols - 1); // skip over for
search
for( ; index < this.navLayerForms.length; index++)
{
if (this.navLayerForms[index].elements[0].name ==
controlName)
{
control = this.navLayerForms[index].elements[0];
break;
}
}
}
else
control = null;

return control;
}

function HTDW_itemGainFocus(newRow,newCol,control,gob)
{
var bRowChanged = false;
var bReadOnlyControl = false;
var bNegativeTabIndexControl = false;

// default arguments
control.row = newRow;
control.col = newCol;
control.gob = gob;

// if in the middle of trying to force focus back
// to a control, ignore all other focus stuff
if (this.forcingBackFocusTo != null)
{
// check if we have made it back yet
if (this.forcingBackFocusTo == control)
{
this.forcingBackFocusTo = null;
this.currentControl = control;
}
// don't do any other focus related stuff
return;
}

// bail if we think that the current control already has focus
// (Could happen if a button is pressed)
if (this.currentControl == control &&
!(this.currentControl.type == "hidden" || this.currentControl.type
== "password" ||
this.currentControl.type == "text" || this.currentControl.type ==
"textarea"))
return;

// check control attri
if (control.readOnly + "" != "undefined")
{
bReadOnlyControl = control.readOnly;
}
if (control.tabIndex + "" != "undefined")
{
if(control.tabIndex < 0 )
bNegativeTabIndexControl = true;
}

if (bNegativeTabIndexControl)
{
control.blur(); //don't allow focus.
return;
}

if (newRow != -1)
{
if (newRow != this.currRow)
{
bRowChanged = true;


// row focus changing event
if (this.eventImplemented("RowFocusChanging"))
{
var result = _evtDefault(this.RowFocusChanging
(this.currRow+1, newRow+1));
// if 1 returned, don't allow focus to change (leave
focus in last control to have gained focus
if (result == 1)
{
this.restoreFocus();
// bail out early
return;
}
}

}

this.currRow = newRow;
}
if (newCol != -1)
this.currCol = newCol;

this.currentControl = control;

// update the displayed value to be in editible form
if (newRow != -1 && newCol != -1 &&
(this.currentControl.type == "hidden" || this.currentControl.type
== "password" ||
this.currentControl.type == "text" ||this.currentControl.type ==
"textarea"))
{
var value = this.rows[newRow][newCol];
if (gob.format != null)
{
var displayValue;

if (gob.getEditFormat != null)
{
var formatString;
if (typeof gob.getEditFormat == "string")
formatString = gob.getEditFormat;
else
{
var exprCtx = this.exprCtx;
exprCtx.row = control.row;
exprCtx.currentText = "";
formatString = gob.getEditFormat (exprCtx);
}
displayValue = gob.format (formatString, value,
this.currentControl);
}
else if (value != null)
displayValue = value.toString();
else
displayValue = "";
this.currentControl.value = displayValue;
}
else if ( value != null )
{
// Do not compare against Date/Time if no date fields have
been defined
if (!bDateTimeProcessingEnabled ||
(value.toString != DW_DatetimeToString &&
value.toString != DW_DateToString &&
value.toString != DW_TimeToString))
this.currentControl.value = value.toString( );
}
else
this.currentControl.value = "";
}

// can only programatically change border on IE4
if (control.gob.bFocusRect && HTDW_DataWindowClass.isIE4)
{
this.currentControlBorder = control.style.borderStyle;
control.style.borderStyle = "dotted";
}


// row focus changed event
if (bRowChanged && this.eventImplemented("RowFocusChanged"))
this.RowFocusChanged (newRow+1)

// item focus changed event
if (newCol != -1 && this.eventImplemented("ItemFocusChanged"))
this.ItemFocusChanged (newRow+1, this.cols[newCol].name)

}

function HTDW_itemLoseFocus(control)
{
var bReadOnlyControl = false;
var bNegativeTabIndexControl = false;

// check control attri
if (control.readOnly + "" != "undefined")
{
bReadOnlyControl = control.readOnly;
}
if (control.tabIndex + "" != "undefined")
{
if( control.tabIndex < 0 )
bNegativeTabIndexControl = true;
}

if (bNegativeTabIndexControl)
{
return 2;
}

// restore border
// can only programatically change border on IE4
if (control.gob.bFocusRect && HTDW_DataWindowClass.isIE4 &&
this.currentControl == control)
control.style.borderStyle = this.currentControlBorder;

// don't do validation if in the middle of forcing focus
// due to validation error (endless loop could happen)
if (this.forcingBackFocusTo != null)
return 2;

if (this.currentControl != control)
{
alert("Focus problem! Control losing focus is not current
control!");
// fake it out
this.currentControl = control;
}

var gob = control.gob;
if (gob.getEditFormat != null)
{
if (typeof gob.getEditFormat == "string")
gMask = gob.getEditFormat;
else
{
var exprCtx = this.exprCtx;
exprCtx.row = control.row;
exprCtx.currentText = "";
gMask = gob.getEditFormat (exprCtx);
}

// code table's edit format is a dummy "CodeTable" format for info.
if (gob.bUseCodeTable)
gMask = "";
}

if (!control.bChanged) // check if Change misfired (losing focus
beyond frame?)
{
var newValue;
var row = control.row;
var col = control.col;
var rowObj = this.rows[row];
var colObj = this.cols[col];

if (control.type == "select-one")
newValue = control.options[control.selectedIndex].value;
else
newValue = control.value;

if (newValue == "")
{
if (control.gob.bNilIsNull)
{
if (rowObj[col] != null)
control.bChanged = true;
}
else if (rowObj[col] != null && rowObj[col] != "") // for inserts
control.bChanged = true;
}
else if (colObj.convertFromString != null)
{
var convertedValue;
if (colObj.convertFromString == parseInt)
{
var reg = /,/g;
var noComma = newValue.replace(reg, "");
convertedValue = colObj.convertFromString (noComma, 10);
}
else
convertedValue = colObj.convertFromString (newValue);

if (rowObj[col] != convertedValue)
control.bChanged = true;
}
else
{
if (rowObj[col] != newValue)
control.bChanged = true;
}
}

var result = this.AcceptText();

gMask = "";

if (result == 1)
{
// reformat the data
var gob = control.gob;
var value = this.rows[control.row][gob.colNum];

if (control.type == "hidden" || control.type == "password" ||
control.type == "text" || control.type == "textarea")
{
if (gob.format != null)
{
var displayValue;

if (gob.getDisplayFormat != null)
{
var formatString;
if (typeof gob.getDisplayFormat == "string")
formatString = gob.getDisplayFormat;
else
{
var exprCtx = this.exprCtx;
exprCtx.row = control.row;
exprCtx.currentText = "";
formatString = gob.getDisplayFormat (exprCtx);
}
displayValue = gob.format (formatString, value,
this.currentControl);
}
else if (value != null)
displayValue = value.toString();
else
displayValue = "";
this.currentControl.value = displayValue;
}
else if ( value != null )
{
// Do not compare against Date/Time if no date fields
have been defined
if (!bDateTimeProcessingEnabled ||
(value.toString != DW_DatetimeToString &&
value.toString != DW_DateToString &&
value.toString != DW_TimeToString))
this.currentControl.value = value.toString( );
}
else
this.currentControl.value = "";
}
}

return result;
}

function HTDW_selectControlContent(control)
{
var bNegativeTabIndexControl = false;
if(control != null)
{
if (control.tabIndex + "" != "undefined")
{
if( control.tabIndex < 0 )
bNegativeTabIndexControl = true;
}

if(!bNegativeTabIndexControl)
{
control.select();
}
}
}

function HTDW_getChanges()
{
var changes = "";
var index, rowObj;
for (index=0; index < this.rows.length; ++index)
{
rowObj = this.rows[index];
if (rowObj != null)
{
HTDW_RowClass.dumpRow (index, rowObj);
changes += HTDW_RowClass.generateChange (index, rowObj);
}
}
return changes;
}

function HTDW_itemError(row, col, exprCtx, bIsRequired)
{
var colObj = this.cols[col];
var result = 0;


// item error event
if (this.eventImplemented("ItemError"))
result = _evtDefault(this.ItemError (row+1, colObj.name,
exprCtx.currentText))


// map unknown results to 0
if (result != 1 && result != 2 && result != 3)
result = 0;

if (result == 0)
{
var sMessage;
if (colObj.validationError != null)
sMessage = colObj.validationError (exprCtx);
else if (bIsRequired)
sMessage = "Value required for item '" + colObj.name +
"'.";
else
sMessage = "Item '" + exprCtx.currentText + "' does not
pass validation test.";

alert (sMessage);
}

return result;
}

function HTDW_restoreFocus()
{
if (this.currentControl != null)
{
var bDocHasFocus = true;
var bIsDefined = false;

if ( (document.hasFocus + "" != "undefined") &&
(this.currentControl.setActive + "" != "undefined") )
bIsDefined = true;

if ( bIsDefined )
{
bDocHasFocus = document.hasFocus();
}

if(bDocHasFocus == false)
this.currentControl.setActive(); // CR323659
else
this.currentControl.focus();
}
}

function HTDW_setCheckboxValue(control, chkValue, unchkValue)
{
if (control.checked)
control.value = chkValue;
else
control.value = unchkValue;
}

function HTDW_acceptText()
{
// nothing to do if no current control
if (this.currentControl == null)
return 1;

var control = this.currentControl;
var row = control.row;
var col = control.col;
var bRequired = control.gob.bRequired;
var colObj = this.cols[col];
var bIsValid = true;
var exprCtx = this.exprCtx;
var validAction = 2; // default to accept
var newValue;
if (control.type == "select-one")
newValue = control.options[control.selectedIndex].value;
else
newValue = control.value;

exprCtx.row = row;
exprCtx.currentText = newValue;

// check if value required
if (bRequired && ! control.bChanged)
{
if (this.rows[row][col] == null)
validAction = this.itemError (row, col, exprCtx, true);
}
else if (bRequired && control.gob.bNilIsNull && newValue == "")
validAction = this.itemError (row, col, exprCtx, true);

if (control.bChanged)
{
if (bIsValid && colObj.validateByType != null)
bIsValid = colObj.validateByType(newValue,
control.gob.bNilIsNull);

if (bIsValid && colObj.validateItem != null)
bIsValid = colObj.validateItem (exprCtx);


// item changed event
if (bIsValid && this.eventImplemented("ItemChanged"))
{
validAction = _evtDefault(this.ItemChanged (row+1,
colObj.name, newValue));
// map unknown results to 0
if (validAction != 1 && validAction != 2)
validAction = 0;
// map itemChanged action codes to itemError action codes
if (validAction == 0) // accept value
validAction = 2;
else
{
bIsValid = false;
if (validAction == 1) // reject value, no focus change
validAction = 1;
else // reject value, allow focus change
validAction = 3;
}
}


if (! bIsValid)
validAction = this.itemError (row, col, exprCtx, false);

if (validAction == 2)
{
var rowObj = this.rows[row];
if (control.gob.bNilIsNull && newValue == "")
{
if (rowObj[col] != null)
{
rowObj[col] = null;
if (rowObj[0].itemStatus != DW_ITEMSTATUS_MODIFIED
&&
rowObj[0].itemStatus !=
DW_ITEMSTATUS_NEW_MODIFIED)
this.modifiedCount++;
rowObj[0].colModified[col] = true;
if (rowObj[0].itemStatus ==
DW_ITEMSTATUS_NOCHANGE)
rowObj[0].itemStatus = DW_ITEMSTATUS_MODIFIED;
else if (rowObj[0].itemStatus ==
DW_ITEMSTATUS_NEW)
rowObj[0].itemStatus =
DW_ITEMSTATUS_NEW_MODIFIED;
}
}
else if (colObj.convertFromString != null)
{
var convertedValue;
if (colObj.convertFromString == parseInt)
convertedValue = colObj.convertFromString (newValue, 10);
else
convertedValue = colObj.convertFromString (newValue);

if (rowObj[col] != convertedValue)
{
rowObj[col] = convertedValue;
if (rowObj[0].itemStatus != DW_ITEMSTATUS_MODIFIED
&&
rowObj[0].itemStatus !=
DW_ITEMSTATUS_NEW_MODIFIED)
this.modifiedCount++;
rowObj[0].colModified[col] = true;
if (rowObj[0].itemStatus ==
DW_ITEMSTATUS_NOCHANGE)
rowObj[0].itemStatus = DW_ITEMSTATUS_MODIFIED;
else if (rowObj[0].itemStatus ==
DW_ITEMSTATUS_NEW)
rowObj[0].itemStatus =
DW_ITEMSTATUS_NEW_MODIFIED;
}
}
else
{
if (rowObj[col] != newValue)
{
rowObj[col] = newValue;
if (rowObj[0].itemStatus != DW_ITEMSTATUS_MODIFIED
&&
rowObj[0].itemStatus !=
DW_ITEMSTATUS_NEW_MODIFIED)
this.modifiedCount++;
rowObj[0].colModified[col] = true;
if (rowObj[0].itemStatus ==
DW_ITEMSTATUS_NOCHANGE)
rowObj[0].itemStatus = DW_ITEMSTATUS_MODIFIED;
else if (rowObj[0].itemStatus ==
DW_ITEMSTATUS_NEW)
rowObj[0].itemStatus =
DW_ITEMSTATUS_NEW_MODIFIED;
}
}
control.bChanged = false;
// skip current control
colObj.updateDependents(this, row, true);
}
}

// force focus back if an error (focus change will happen after we
return!)
if (validAction < 2)
{
this.forcingBackFocusTo = control;
control.focus();
}

var result = (validAction < 2) ? -1 : 1;

return result;
// this return will only be used if we are not an input form
return 1;
}


// if false returned, don't allow focus to change or action to happen
(leave focus in last control to have gained focus
function HTDW_itemClicked(row, col, objName)
{
var evtResult = 0;

// CR228156 - click on DDDW column fires a validation error in
IE5.x - Partha
if (this.currentControl != null)
{
if ( this.currentControl.type == "select-one" )
{
if ( HTDW_DataWindowClass.isIE4
&& this.currentControl.gob.bRequired == true
&& this.currentControl.value == "" )
return false ;
else
if (this.AcceptText() != 1)
return false;

}
else if (this.currentControl.type == "checkbox"
|| this.currentControl.type == "radio"
|| this.currentControl.type == "select-multiple" )
{
if (this.AcceptText() != 1)
return false;
}
}

if (this.eventImplemented("Clicked"))
evtResult = _evtDefault(this.Clicked (row+1, objName));

// prevent clicked event from bubbling up in IE4 or higher
if (HTDW_DataWindowClass.isIE4)
window.event.cancelBubble = true;

this.clickedRow = row;
this.clickedCol = col;

return evtResult != 1;
}

function HTDW_performAction(action)
{
this.action = action;
if (this.b4GLWeb)
{
// cause the surrounding page to be submitted
if (this.submit + "" != "undefined") //Asp.Net
this.submit();
else
psPage.Submit(); //Jsp Target
}
else // deal with it like in 7.0
{
var rc = 0;
// OnSubmit can prevent the page from being submitted by
returning 1
if (this.eventImplemented("OnSubmit"))
rc = _evtDefault(this.OnSubmit ());
if (rc == 0)
{
this.actionField.value = this.action;
this.contextField.value = this.GetFullContext();
this.submitForm.submit();
}
}
}

function HTDW_GetFullContext()
{
var result = this.context;

result += "(";
result += this.getChanges();
if (this.currRow != -1)
result += "(row " + this.currRow + ")";
if (this.sortString != null)
result += "(sortString '" + escapeString (this.sortString) +
"')";
result += ")";

return result ;
}

function HTDW_buttonPress(action, row, buttonName)
{
var evtResult;

// false from clicked will cancel processing
if (!this.itemClicked(row, -1, buttonName))
return;

// button clicking event
if (this.eventImplemented("ButtonClicking"))
{
evtResult = _evtDefault(this.ButtonClicking (row+1,
buttonName));
// non-zero return will cancel processing
if (evtResult != 0)
return;
}

// make sure all changes have been recorded
if (action != "" && this.AcceptText() != 1)
// cancel processing if AcceptText fails
return;

// update start event
if (action == "Update" && this.eventImplemented("UpdateStart"))
{
evtResult = _evtDefault(this.UpdateStart ());
// a return of 1 will cancel action
if (evtResult == 1)
return;
}

if (action == "Print")
{
window.print();
return;
}
// an action of "" is a user defined button which doesn't cause a
page reload
if (action != "")
this.performAction(action);
else
{
// button clicked event
if (this.eventImplemented("ButtonClicked"))
this.ButtonClicked (row+1, buttonName)
}
}

function HTDW_getColNum(col)
{
if (typeof col == "string")
{
for (var i=1; i< this.cols.length; ++i)
{
var colObj = this.cols[i];
if (colObj.name == col)
return i;
}
}
else
return col;

// if we get here, then we couldn't find it
return -1;
}

function HTDW_DeletedCount()
{
return this.deletedCount;
}

function HTDW_DeleteRow(row)
{
if(this.AcceptText() == 1)
{
if (row > 0)
this.currRow = row-1;
this.performAction ("DeleteRow");
return 1;
}
else
return -1;
}

function HTDW_GetClickedColumn()
{
return this.clickedCol;
}

function HTDW_GetClickedRow()
{
return this.clickedRow + 1;
}

function HTDW_GetColumn()
{
return this.currCol;
}

function HTDW_GetNextModified(startRow)
{
var nextModified = 0;
var index, rowObj;

if (startRow == null)
return null;

for (index=startRow-1; index < this.rows.length; ++index)
{
rowObj = this.rows[index];
if (rowObj != null)
{
if (rowObj[0].itemStatus == DW_ITEMSTATUS_MODIFIED ||
rowObj[0].itemStatus == DW_ITEMSTATUS_NEW_MODIFIED)
{
nextModified = index+1;
break;
}
}
}
return nextModified;
}

function HTDW_GetRow()
{
return this.currRow + 1;
}

function HTDW_GetItem(row, col)
{
var result;
var colNum = this.getColNum(col);
var rowObj = this.rows[row-1];

if (colNum == -1 ||
(rowObj + "" == "undefined") ||
rowObj[colNum] + "" == "undefined")
result = -1;
else
result = rowObj[colNum];

return result;
}

function HTDW_GetItemStatus(row, col)
{
if (row == null || col == null)
return null;

var dwItemStatus = DW_ITEMSTATUS_NOCHANGE;
var colNum = this.getColNum(col);
var rowObj = this.rows[row-1];

if (colNum == -1 ||
(rowObj + "" == "undefined") ||
(colNum > 0 && rowObj[colNum] + "" == "undefined"))
dwItemStatus = -1;
else if (colNum == 0)
dwItemStatus = rowObj[0].itemStatus;
else
{
if (rowObj[0].colModified[colNum])
dwItemStatus = DW_ITEMSTATUS_MODIFIED;
}

return dwItemStatus;
}

function HTDW_InsertRow(row)
{
if(this.AcceptText() == 1)
{
this.currRow = row-1;
this.performAction ("InsertRow");
return 1;
}
else
return -1;
}

function HTDW_ModifiedCount()
{
return this.modifiedCount;
}

function HTDW_Retrieve()
{
if(this.AcceptText() == 1)
{
this.performAction ("Retrieve");
return 1;
}
else
return -1;
}

function HTDW_RowCount()
{
return this.rowCount;
}

function HTDW_ScrollFirstPage()
{
if(this.AcceptText() == 1)
{
this.performAction ("PageFirst");
return 1;
}
else
return -1;
}

function HTDW_ScrollLastPage()
{
if(this.AcceptText() == 1)
{
this.performAction ("PageLast");
return 1;
}
else
return -1;
}

function HTDW_ScrollNextPage()
{
if(this.AcceptText() == 1)
{
this.performAction ("PageNext");
return 1;
}
else
return -1;
}

function HTDW_ScrollPriorPage()
{
if(this.AcceptText() == 1)
{
this.performAction ("PagePrior");
return 1;
}
else
return -1;
}

function HTDW_SetItem(row,col,value)
{
var result;
var colNum = this.getColNum(col);
var rowObj = this.rows[row-1];

if (colNum == -1 ||
(rowObj + "" == "undefined") ||
rowObj[colNum] + "" == "undefined")
result = -1;
else
{
if (rowObj[colNum] != value)
{
rowObj[colNum] = value;
if (rowObj[0].itemStatus != DW_ITEMSTATUS_MODIFIED &&
rowObj[0].itemStatus != DW_ITEMSTATUS_NEW_MODIFIED)
this.modifiedCount++;
rowObj[0].colModified[colNum] = true;
if (rowObj[0].itemStatus == DW_ITEMSTATUS_NOCHANGE)
rowObj[0].itemStatus = DW_ITEMSTATUS_MODIFIED;
else if (rowObj[0].itemStatus == DW_ITEMSTATUS_NEW)
rowObj[0].itemStatus = DW_ITEMSTATUS_NEW_MODIFIED;
}

// update them all
this.cols[colNum].updateDependents(this, row-1, false);
result = 1;
}

return result;
}

function HTDW_SetColumn(col)
{
var result = -1;
var colNum = this.getColNum(col);

if (colNum != -1)
{
var colObj = this.cols[colNum];
if (typeof colObj != "undefined" && colObj.displayGobName !=
null)
{
var control = this.findControl(colObj.displayGobName,
this.currRow, true);
// if we can't find a control, then we can't set the
column
if (control != null)
{
// force focus onto the found control
// the onFocus event will change the currency
variables
control.focus();
result = 1;
}
}
}
return result;
}

function HTDW_SetRow(row)
{
var result = -1;
row -= 1;
var colNum = this.currCol;

if (colNum != -1)
{
var colObj = this.cols[colNum];
if (typeof colObj != "undefined" && colObj.displayGobName !=
null)
{
var control = this.findControl(colObj.displayGobName, row,
true);
// if we can't find a control, then we can't set the row
if (control != null)
{
// force focus onto the found control,
// the onFocus event will change the currency
variables
control.focus();
result = 1;
}
}
}
return result;
}

function HTDW_SetSort(sortString)
{
this.sortString = sortString;
return 1;
}

function HTDW_Sort()
{
if(this.AcceptText() == 1)
{
this.performAction ("Sort");
return 1;
}
else
return -1;
}

function HTDW_Update()
{
if(this.AcceptText() == 1)
{
this.performAction ("Update");
return 1;
}
else
return -1;
}

function DW_EditKeyPressed(nCase)
{
if(nCase == 1)
{
event.srcElement.value +=
String.fromCharCode(event.keyCode).toUpperCase();
event.returnValue = false;
}
else if (nCase == 2)
{
event.srcElement.value +=
String.fromCharCode(event.keyCode).toLowerCase();
event.returnValue = false;
}
}

function HTDW_DataWindowClass(name, submitForm, actionField,
contextField)
{
// if used in 4GL web, these will not be defined!
if (arguments.length == 1)
{
submitForm = null;
actionField = null;
contextField = null;
}

this.name = name;
this.submitForm = submitForm;
this.actionField = actionField;
this.contextField = contextField;
this.sortString = null;
this.action = "";

// private functions
this.buttonPress = HTDW_buttonPress;
this.performAction = HTDW_performAction;

this.eventImplemented = HTDW_eventImplemented;
this.itemClicked = HTDW_itemClicked;

// public function
this.GetFullContext = HTDW_GetFullContext;

this.currRow = -1;
this.currCol = -1;
this.forcingBackFocusTo = null;
this.currentControl = null;
this.bSingleRow = false;

this.gobs = new Object();
this.rows = new Array();
this.cols = new Array();
this.navLayerForms = new Array();
this.exprCtx = new HTDW_exprContextClass(this);

// private functions
this.getChanges = HTDW_getChanges;
this.itemLoseFocus = HTDW_itemLoseFocus;
this.selectControlContent = HTDW_selectControlContent;
this.itemError = HTDW_itemError;
this.itemGainFocus = HTDW_itemGainFocus;
this.restoreFocus = HTDW_restoreFocus;
this.findControl = HTDW_findControl;
this.setCheckboxValue = HTDW_setCheckboxValue;

// public functions
this.AcceptText = HTDW_acceptText;

// private functions
this.getColNum = HTDW_getColNum;

// public functions
this.AcceptText = HTDW_acceptText;
this.DeletedCount = HTDW_DeletedCount;
this.DeleteRow = HTDW_DeleteRow;
this.GetClickedColumn = HTDW_GetClickedColumn;
this.GetClickedRow = HTDW_GetClickedRow;
this.GetColumn = HTDW_GetColumn;
this.GetNextModified = HTDW_GetNextModified;
this.GetRow = HTDW_GetRow;
this.GetItem = HTDW_GetItem;
this.GetItemStatus = HTDW_GetItemStatus;
this.InsertRow = HTDW_InsertRow;
this.ModifiedCount = HTDW_ModifiedCount;
this.Retrieve = HTDW_Retrieve;
this.RowCount = HTDW_RowCount;
this.ScrollFirstPage = HTDW_ScrollFirstPage;
this.ScrollLastPage = HTDW_ScrollLastPage
this.ScrollNextPage = HTDW_ScrollNextPage
this.ScrollPriorPage = HTDW_ScrollPriorPage
this.SetItem = HTDW_SetItem
this.SetColumn = HTDW_SetColumn
this.SetRow = HTDW_SetRow
this.SetSort = HTDW_SetSort
this.Sort = HTDW_Sort;
this.Update = HTDW_Update
}

// determine the client browser
// this should be used only where ABSOLUTELY necessary
// Generic JavaScript should be used where ever possible
HTDW_DataWindowClass.isNav4 = false;
HTDW_DataWindowClass.isIE4 = false;
if (parseInt(navigator.appVersion) >= 4)
{
HTDW_DataWindowClass.isNav4 = (navigator.appName == "Netscape");
HTDW_DataWindowClass.isIE4 =
(navigator.appName.indexOf("Microsoft") != -1);
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">

// create our control object
webDW_1 = new HTDW_DataWindowClass("webDW_1");


// save state for scripting functions
webDW_1.rowCount = 10;
webDW_1.deletedCount = 0;
webDW_1.filteredCount = 0;
webDW_1.modifiedCount = 0;
webDW_1.sortString = "?";
webDW_1.bStylePositioning = true;
webDW_1.b4GLWeb = true;


webDW_1.context = "(webDW_1 0)(400 )";

var DW_shortDateFormat = "M/d/yyyy";
var DW_longDateFormat = "dddd, MMMM dd, yyyy";
var DW_timeFormat = "hh:mm:ss";

var DW_posCurrencyFormat = "$#,##0.00";
var DW_negCurrencyFormat = "($#,##0.00)";
var DW_decimalChar = ".";
var DW_thousandsChar = ",";
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">


function DW_FloatParse(inString)
{
var result = new DW_NumberClass();

if (DW_parseNumberStringAgainstMask(inString, result, true))
{
return result.number;
}
else
return null;
}

function DW_IntParse(inString)
{
var result = new DW_NumberClass();

if (DW_parseNumberStringAgainstMask(inString, result, false))
{
return result.number;
}
else
return null;
}

function DW_parseNumberStringAgainstMask(inString, outNumber, bFloat)
{
var Mask = gMask;

var format;
var bNegative = false;

// try special case first
if (Mask == "") // unformatted data
{
var n = 0;
if (bFloat)
n = parseFloat(inString);
else
n = parseInt(inString);

if (isNaN(n))
return false;

if(outNumber != null)
outNumber.number = n;

return true;
}

if (Mask.toLowerCase() == "[currency]")
{
bFloat = true;
if (inString.charAt(0) == DW_negCurrencyFormat.charAt(0))
{
format = new DW_NumberEncodingClass(DW_negCurrencyFormat,
DWFMT_section_positive);
bNegative = true;
}
else
format = new DW_NumberEncodingClass(DW_posCurrencyFormat,
DWFMT_section_positive);
}
else
{
var semiOffset;

semiOffset = Mask.indexOf(";");
if (semiOffset != -1)
{
format = new DW_NumberEncodingClass(Mask.substring(0,
semiOffset), DWFMT_section_positive);
Mask = Mask.substring(0, semiOffset);
}
else
format = new DW_NumberEncodingClass(Mask,
DWFMT_section_positive);
}

if(!format.bValid)
return false;


// Create a new number class
var nm = new DW_NumberClass();

var STATESECTION = 0;
var STATENUMBER = 1;
var STATEDECIMAL = 2;
var STATEASIS = 3;

var currChar;
var charIndex = 0;
var state;
var prvState;
var isInteger = false;

var key; // To hold number and strings
var nVal; // To store integer value

var index = 0;
var encodedFormat = format.encodedFormat;
var action;

while (charIndex < inString.length && index < encodedFormat.length)
{

// Initialize
state = prvState = STATESECTION;

key = "";
nVal = 0;

// Extract one token from inString
do{
currChar = inString.charAt (charIndex);
if (state == STATESECTION)
{
if (currChar == '.')
state = STATEDECIMAL;

else if (allowInString(currChar, "1234567890+-"))
state = STATENUMBER;

else
state = STATEASIS;
}
else if (state == STATEDECIMAL)
{
if(bFloat != true)
isInteger = true;

key += currChar;
charIndex++;

state = STATESECTION; // Change state for next char
prvState = STATEDECIMAL;
}
else if(state == STATENUMBER)
{
if((key == "") && ((currChar == '-') || (currChar == '+')))
{
if (currChar == '-')
bNegative = true;

charIndex++;
}
else
{
key += currChar;
charIndex++;

// Skip comma character
if(inString.charAt (charIndex) == ',')
{
charIndex++;

// Next character should be a digit
if(!DW_parseIsDigit(inString.charAt (charIndex)))
return false;
}

if (!DW_parseIsDigit(inString.charAt (charIndex)))
{
state = STATESECTION; // Change state for next char
prvState = STATENUMBER;
nVal = key - 0;
}
}
}
else if (state == STATEASIS)
{
key += currChar;
charIndex++;

if (allowInString (inString.charAt (charIndex), "1234567890.+-"))
{
state = STATESECTION; // Change state for next char
prvState = STATEASIS;
}
}
else
{
return false; // Unspecified error
}

}while(charIndex < inString.length && state != STATESECTION)


// Now extract one token from encode string

action = 0;

if( index < encodedFormat.length)
{
action = encodedFormat[index];
index++;
}

if ((typeof action == "string") && (prvState != STATEASIS))
{
// Skip ASIS Format
action = encodedFormat[index];
index++;
}

if ((action == DWFMT_integer || action == DWFMT_integer_comma) &&
(prvState == STATEDECIMAL))
{
// Skip Integer Action
action = encodedFormat[index+2];
index+=3;

if (action != DWFMT_decimal)
return false;
}

if (typeof action == "string")
{
if (key != action)
return false;
}
else if(action == DWFMT_decimal)
{
if (key != ".")
return false;
}
else if(action == DWFMT_integer || action == DWFMT_integer_comma)
{
numReq = encodedFormat[index]; index ++;
numOpt = encodedFormat[index]; index ++;

if (!format.bMult100 && (key.length > numReq + numOpt))
return false;

nm.number = nVal;
}
else if (action == DWFMT_fraction)
{
numReq = encodedFormat[index]; index ++;
numOpt = encodedFormat[index]; index ++;

if (key.length > numReq + numOpt)
return false;

var tString = "." + key;

nm.number += tString;
}
}

if (bNegative)
nm.number *= -1;

if(nm.number == 0)
nm.number = "0.0"

if (format.bMult100)
nm.number = nm.number/100.0;

if (isInteger)
nm.number = Math.floor(nm.number);

if(outNumber != null)
outNumber.number = nm.number;

return true;
}


//
// Number formatting code
//
var DWFMT_integer_comma = 1;
var DWFMT_integer = 2;
var DWFMT_fraction = 3;
var DWFMT_decimal = 4;
var DWFMT_exp_integer_comma = 5;
var DWFMT_exp_integer = 6;
var DWFMT_exp_fraction = 7;
var DWFMT_exp_exp = 8;
var DWFMT_exp_sign = 9;
var DWFMT_exp_sign_opt = 10;
var DWFMT_general = 11;
var DWFMT_asis_digit = 12;

var DWFMT_type_normal = 1;
var DWFMT_type_exp = 2;
var DWFMT_type_percent = 3;
var DWFMT_type_asis = 4;

var DWFMT_section_positive = 0;
var DWFMT_section_negative = 1;
var DWFMT_section_zero = 2;
var DWFMT_section_null = 3;

function DW_NumberEncodingClass(inString,section)
{
var STATE_START = 1;
var STATE_LEFTDEC = 2;
var STATE_RIGHTDEC = 3;
var STATE_TESTASIS = 4;
var STATE_ASIS = 5;

var index;
var currState = STATE_START;
var currChar;
var encodedFormat = new Array();
var accum = "";
var numInSection;
var offset = 0;
var bValid = true;
// state flags
var bOnLeft = true;
var bDidLeft = false;
var bOnExp = false;
var bCommas = false;
var reqDigits = 0;
var optDigits = 0;
var totDigits = 0;
var numDecPlaces = 0;

// misc variable
var nextChar;
var nextNextChar;

this.encodedFormat = encodedFormat;
this.color = "";
this.bMult100 = false;
this.maskType = DWFMT_type_normal;
this.bGeneral = false;

var strLen = inString.length;
for (index=0; index <= strLen && bValid; )
{
if (index < strLen)
currChar = inString.charAt(index);
else
currChar = "";
if (currState == STATE_START)
{
// handle keywords
if (currChar == "[")
{
if (accum != "")
encodedFormat[offset++] = accum;
accum = "";
index++;
for (; inString.charAt(index) != "]"; index++)
accum += inString.charAt(index);
index++; // skip ]
var inlineEncoding = null;
var keyword = accum.toUpperCase();
if (keyword == "GENERAL")
{
encodedFormat[offset++] = DWFMT_general;
this.bGeneral = true;
}
else if (keyword == "CURRENCY")
{
if (section == DWFMT_section_positive || section
== DWFMT_section_null)
inlineEncoding = new
DW_NumberEncodingClass(DW_posCurrencyFormat, section);
else if(section == DWFMT_section_negative)
inlineEncoding = new
DW_NumberEncodingClass(DW_negCurrencyFormat, section);
else
bValid = false;
}
else
{
if (!parseInt(accum))
this.color = accum.toLowerCase();
else
this.color = eval(accum);
this.keyword = accum;
}
// if we build another format, inline it into current
one
if (inlineEncoding != null && inlineEncoding.bValid)
{
var innerFormat = inlineEncoding.encodedFormat;
for (var j=0; j<innerFormat.length; j++)
encodedFormat[offset++] = innerFormat[j];
}
accum = "";
}
else if (currChar == "#")
{
if (accum != "")
encodedFormat[offset++] = accum;
accum = "";
if (bOnLeft && bDidLeft)
currState = STATE_TESTASIS;
else if(bOnLeft)
currState = STATE_LEFTDEC;
else
currState = STATE_RIGHTDEC;
// reset accumulators
reqDigits = 0;
totDigits = 0;
optDigits = 0;
bCommas = false;
}
else if (currChar == "0")
{
if (accum != "")
encodedFormat[offset++] = accum;
accum = "";
if (bOnLeft && bDidLeft)
currState = STATE_TESTASIS;
else if(bOnLeft)
currState = STATE_LEFTDEC;
else
currState = STATE_RIGHTDEC;
// reset accumulators
reqDigits = 0;
totDigits = 0;
optDigits = 0;
bCommas = false;
}
else if (currChar == ".")
{
if (accum != "")
encodedFormat[offset++] = accum;
accum = "";
index++;
if (bOnLeft)
{
encodedFormat[offset++] = DWFMT_decimal;
bOnLeft = false;
}
// we want only 1 period char!
else
bValid = false;
}
else if (currChar == "e" || currChar == "E")
{
accum += currChar;
index++;
nextChar = inString.charAt(index);
nextNextChar = inString.charAt(index+1);
if ((nextChar == "-" || nextChar == "+") &&
(nextNextChar == "#" || nextNextChar == "0"))
{
bOnExp = true;
bOnLeft = false;
if (nextChar == "+")
encodedFormat[offset++] = DWFMT_exp_sign;
else
encodedFormat[offset++] = DWFMT_exp_sign_opt;
// correct prior encodings
for (i=0; i < encodedFormat.length;i++)
{
if (typeof encodedFormat[i] == "number")
{
var lastFormat = encodedFormat[i];
if (lastFormat == DWFMT_integer_comma)
{
encodedFormat[i] =
DWFMT_exp_integer_comma;
i += 2;
}
else if (lastFormat == DWFMT_integer)
{
encodedFormat[i] = DWFMT_exp_integer;
i += 2;
}
else if (lastFormat == DWFMT_fraction)
{
encodedFormat[i] = DWFMT_exp_fraction;
i += 2;
}
}
}
}
if (this.maskType == DWFMT_type_normal)
this.maskType = DWFMT_type_exp;
else
bValid = false;
}
else if (currChar == "-")
{
// we will allow it to be the first char of the
negative section
if (section == DWFMT_section_negative &&
offset == 0 && accum == "")
{
accum += currChar;
index++;
}
else
currState = STATE_TESTASIS;
}
else if (currChar == "%")
{
accum += currChar;
index++;
if (this.maskType == DWFMT_type_normal)
{
this.maskType = DWFMT_type_percent;
this.bMult100 = true;
}
else
bValid = false;
}
else if (currChar == "\\")
{
index++;
accum += inString.charAt(index++);
}
else if (currChar == "'")
{
index++;
while (index < strLen)
{
currChar = inString.charAt(index);
if (currChar == "'")
break;
accum += currChar;
index++;
}
// check if we fell off end before finding closing
quotes
if (index == strLen)
bValid = false;

index++; // skip trailing '
}
else
{
accum += currChar;
index++;
}
}
else if (currState == STATE_LEFTDEC)
{
nextChar = inString.charAt(index+1);
if (currChar == "#")
{
optDigits++;
if(!bOnExp)
totDigits++;
index++;
}
else if(currChar == "0")
{
reqDigits++;
if(!bOnExp)
totDigits++;
index++;
}
else if(currChar == "," &&
(nextChar == "#" || nextChar == "0"))
{
bCommas = true;
index++;
}
else
{
if (bCommas)
encodedFormat[offset++] = DWFMT_integer_comma;
else
encodedFormat[offset++] = DWFMT_integer;
encodedFormat[offset++] = reqDigits;
encodedFormat[offset++] = optDigits;
currState = STATE_START;
}
}
else if (currState == STATE_RIGHTDEC)
{
if (currChar == "#")
{
numDecPlaces++;
optDigits++;
if(!bOnExp)
totDigits++;
index++;
}
else if(currChar == "0")
{
numDecPlaces++;
reqDigits++;
if(!bOnExp)
totDigits++;
index++;
}
else
{
if (bOnExp)
encodedFormat[offset++] = DWFMT_exp_exp;
else
encodedFormat[offset++] = DWFMT_fraction;
encodedFormat[offset++] = reqDigits;
encodedFormat[offset++] = optDigits;
currState = STATE_START;
}
}
else if (currState == STATE_TESTASIS)
{
// convert to asis form
for (i=0; i < encodedFormat.length && bValid;i++)
{
if (typeof encodedFormat[i] == "number")
{
if (encodedFormat[i] == DWFMT_integer)
{
encodedFormat[i] = DWFMT_asis_digit;
i += 2;
}
else
bValid = false;
}
}
this.maskType = DWFMT_type_asis;
currState = STATE_ASIS;
}
else if (currState == STATE_ASIS)
{
if (currChar == "#" || currChar == "0")
{
totDigits++;
if (accum != "")
encodedFormat[offset++] = accum;
accum = "";
encodedFormat[offset++] = DWFMT_asis_digit;
encodedFormat[offset++] = 1; // 1 required char
encodedFormat[offset++] = 0; // no optional
}
else
accum += currChar;
index++;
}
}

if (accum != "")
encodedFormat[offset++] = accum;

this.totalDigits = totDigits;

if (encodedFormat.length == 0 )
bValid = false;

this.bValid = bValid;
this.numDecPlaces = numDecPlaces;
}

function DW_NumberClass(number)
{
if (arguments.length == 0)
number = 0.0;

this.number = number;
}

function DW_NumberFormatClass(formatString)
{
this.negativeFormat = null;
this.zeroFormat = null;
this.nullFormat = null;

// try special case first
if (formatString.toLowerCase() == "[currency]")
{
this.positiveFormat = new
DW_NumberEncodingClass(DW_posCurrencyFormat, DWFMT_section_positive);
this.negativeFormat = new
DW_NumberEncodingClass(DW_negCurrencyFormat, DWFMT_section_negative);
this.bValid = this.positiveFormat.bValid &&
this.negativeFormat.bValid;
}
else
{
var bValid = true;
var semiOffset;

semiOffset = formatString.indexOf(";");
if (semiOffset != -1)
{
this.positiveFormat = new
DW_NumberEncodingClass(formatString.substring(0, semiOffset),
DWFMT_section_positive);
formatString = formatString.substring(semiOffset+1,
formatString.length);
semiOffset = formatString.indexOf(";");
if (semiOffset != -1)
{
this.negativeFormat = new
DW_NumberEncodingClass(formatString.substring(0, semiOffset),
DWFMT_section_negative);
formatString = formatString.substring(semiOffset+1,
formatString.length);
semiOffset = formatString.indexOf(";");
if (semiOffset != -1)
{
this.zeroFormat = new
DW_NumberEncodingClass(formatString.substring(0, semiOffset),
DWFMT_section_zero);
this.nullFormat = new
DW_NumberEncodingClass(formatString.substring(semiOffset+1,
formatString.length), DWFMT_section_null);
bValid = bValid && this.nullFormat.bValid;
}
else
this.zeroFormat = new
DW_NumberEncodingClass(formatString, DWFMT_section_zero);
bValid = bValid && this.zeroFormat.bValid;
}
else
this.negativeFormat = new
DW_NumberEncodingClass(formatString, DWFMT_section_negative);

bValid = bValid && this.negativeFormat.bValid
}
else
this.positiveFormat = new
DW_NumberEncodingClass(formatString, DWFMT_section_positive);
this.bValid = bValid && this.positiveFormat.bValid;
}
}

function DW_FormatNumber(formatString, value, control)
{
var numberFormat = new DW_NumberFormatClass(formatString);
var result = "";
var strValue, dotOffset, exponentOffset;
var bRequireNegative = false;
var bNegative = false;
var format;

if (numberFormat.bValid)
{

if (value == null)
{
if (numberFormat.nullFormat != null)
format = numberFormat.nullFormat;
else
format = null;
}
else if (value < 0)
{
bNegative = true;
if (numberFormat.negativeFormat != null)
format = numberFormat.negativeFormat;
else
{
format = numberFormat.positiveFormat;
bRequireNegative = true; // mask will not contain
negative
}
}
else if (value > 0)
format = numberFormat.positiveFormat;
else // == 0
{
if (numberFormat.zeroFormat != null)
format = numberFormat.zeroFormat;
else
format = numberFormat.positiveFormat;
}

// if not format, we just return ""
if (format != null)
{
var index;
var encodedFormat = format.encodedFormat;
var action;
var numReq, numOpt, numDigitsLeft, numDigitsRight, i,
commaDigit;
var accum;
var asIsOffset = 0;

if (format.bMult100 && value != null)
value *= 100;

// round to proper number of decimal places
if (value != null && ! format.bGeneral)
value = DW_Round (value, format.numDecPlaces);

// convert the value to a string
if (value != null)
strValue = value.toString();
else
strValue = "";

// strip off leading minus
if (strValue.charAt(0) == "-")
strValue = strValue.substring(1,strValue.length);

dotOffset = strValue.indexOf(".");
if (dotOffset == -1)
{
numDigitsLeft = strValue.length;
numDigitsRight = 0;
}
else
{
numDigitsLeft = dotOffset;
numDigitsRight = strValue.length - dotOffset - 1;
}

for (index=0; index < encodedFormat.length ; index++)
{
action = encodedFormat[index];
if (typeof action == "string")
result += action;
else if (action == DWFMT_integer_comma)
{
numReq = encodedFormat[index + 1];
numOpt = encodedFormat[index + 2];
index += 2;
if (bRequireNegative)
result += "-";

if (numDigitsLeft < numReq)
{
commaDigit = numReq - 1;
for (i=0;i< numReq-numDigitsLeft;i+
+,commaDigit--)
{
result += "0";
if (commaDigit % 3 == 0 && commaDigit !=
0)
result += DW_thousandsChar;
}
}
else
commaDigit = numDigitsLeft - 1;

for (i=0; i < numDigitsLeft; i++,commaDigit--)
{
result += strValue.charAt(i);
if (commaDigit % 3 == 0 && commaDigit != 0)
result += DW_thousandsChar;
}

}
else if (action == DWFMT_integer)
{
numReq = encodedFormat[index + 1];
numOpt = encodedFormat[index + 2];
index += 2;
if (numDigitsLeft < numReq)
{
for (i=0;i< numReq-numDigitsLeft;i++)
result += "0";
}
for (i=0; i < numDigitsLeft; i++)
result += strValue.charAt(i);
}
else if (action == DWFMT_fraction)
{
numReq = encodedFormat[index + 1];
numOpt = encodedFormat[index + 2];
index += 2;
for (i=0; i < numDigitsRight; i++)
result += strValue.charAt(dotOffset + 1 + i);
if (numDigitsRight < numReq)
{
for (i=0; i < numReq - numDigitsRight; i++)
result += "0";
}
}
else if (action == DWFMT_asis_digit)
{
numReq = encodedFormat[index + 1];
numReq += encodedFormat[index + 2];
index += 2;
for (i=0; i< numReq; i++)
{
result += strValue.charAt (asIsOffset);
asIsOffset++;
}
}
else if (action == DWFMT_decimal)
{
result += DW_decimalChar;
}
else if (action == DWFMT_general)
{
if (value != null)
result += value.toString();
}

// won't deal with exponents for now
else if (action == DWFMT_exp_integer_comma)
{
}
else if (action == DWFMT_exp_integer)
{
}
else if (action == DWFMT_exp_fraction)
{
}
else if (action == DWFMT_exp_exp)
{
}
else if (action == DWFMT_exp_sign)
{
}
else if (action == DWFMT_exp_sign_opt)
{
}
}
}
}
else if ( value != null )
// Simulating a [general] format.
result = value.toString();
else
result = "";

if (this.bStylePositioning && format && format.bValid)
if ( format.color == "" || typeof format.color == "string" )
control.style.color = format.color;
else
control.style.color = convertToRGB( format.color );

return result;
}
webDW_1.cols[1] = new HTDW_ColumnClass(1,
'dept_id',DW_IntParse,DW_IsNumber,null,null,null,'dept_id');
webDW_1.gobs.dept_id = new HTDW_ColumnGob('dept_id',1, 0, 0, false,
false, false, null, null, null, webDW_1.cols[1]);
webDW_1.cols[1].addDepend(new
HTDW_DependColumn(webDW_1.gobs.dept_id));


function DW_StringParse(inString)
{
var result = new DW_StringClass();

if (DW_parseStringAgainstMask(inString, result))
{
return result.str;
}
else
return null;
}

function DW_IsString(inString)
{
if (inString == "")
return true;
return DW_parseStringAgainstMask(inString, null);
}

function DW_parseStringAgainstMask(inString, outStr)
{
var Mask = gMask;

if (Mask == "")
{
if(outStr != null)
outStr.str = inString;
return true;
}

// Get encoded format against mask
var format = new DW_StringEncodingClass(Mask);

// if invald mask, return false
if (!format.bValid) return false;

// Create a new number class
var s = new DW_StringClass();

var currChar;
var charIndex = 0;

var index = 0;
var encodedFormat = format.encodedFormat;
var action;

// Create a new number class
var s = new DW_StringClass();

while (charIndex < inString.length && index < encodedFormat.length)
{
// Now extract one token from encode string
action = 0;

if( index < encodedFormat.length)
{
action = encodedFormat[index];
index++;
}

if (typeof action == "string")
{
currChar = inString.substring(charIndex, charIndex+action.length);
charIndex = charIndex + action.length

if (action != currChar)
return false;
else
continue;
}
else
currChar = inString.charAt(charIndex++);

if(action == DWFMT_allChars)
{
s.str = inString;
break;
}
else if(action == DWFMT_allChar)
{
s.str += currChar;
}
else if(action == DWFMT_stringChar)
{
if (DW_parseIsAlpha(currChar) || DW_parseIsDigit(currChar) ||
currChar==" ")
s.str += currChar;
else
return false;
}
else if(action == DWFMT_upperCaseChar)
{
if (DW_parseIsAlpha(currChar) || DW_parseIsDigit(currChar) ||
currChar==" " || currChar==DW_decimalChar)
s.str += currChar.toUpperCase();
else
return false;
}
else if(action == DWFMT_lowerCaseChar || currChar==" ")
{
if (DW_parseIsAlpha(currChar) || DW_parseIsDigit(currChar) ||
currChar==" " || currChar==DW_decimalChar)
s.str += currChar.toLowerCase();
else
return false;
}
else if(action == DWFMT_numberChar)
{
if (DW_parseIsDigit(currChar))
s.str += currChar;
else
return false;
}
}

if(outStr != null)
outStr.str = s.str;

return true;
}


//
// String formatting code
//
var DWFMT_allChars = 0;
var DWFMT_allChar = 1;
var DWFMT_stringChar = 2;
var DWFMT_upperCaseChar = 3;
var DWFMT_lowerCaseChar = 4;
var DWFMT_numberChar = 5;

function DW_StringEncodingClass(inString)
{
var index;
var currChar;
var encodedFormat = new Array();
var accum = "";
var numInSection;
var offset = 0;
var bValid = true;

this.encodedFormat = encodedFormat;
this.color = "";

var strLen = inString.length;
for (index=0; index < strLen && bValid; )
{
currChar = inString.charAt(index);
// handle keywords
if (currChar == "[")
{
if (accum != "")
encodedFormat[offset++] = accum;
accum = "";
index++;
for (; inString.charAt(index) != "]"; index++)
accum += inString.charAt(index);
index++; // skip ]
if (accum.toUpperCase() == "GENERAL")
encodedFormat[offset++] = DWFMT_allChars;
else
{
if (!parseInt(accum))
this.color = accum.toLowerCase();
else
this.color = eval(accum);
this.keyword = accum;
}
accum = "";
}
else if (currChar == "X" || currChar == "x" || currChar == "@")
{
if (accum != "")
encodedFormat[offset++] = accum;
accum = "";
index++;
encodedFormat[offset++] = DWFMT_allChar;
}
else if (currChar == "A" || currChar == "a")
{
if (accum != "")
encodedFormat[offset++] = accum;
accum = "";
index++;
encodedFormat[offset++] = DWFMT_stringChar;
}
else if (currChar == "!")
{
if (accum != "")
encodedFormat[offset++] = accum;
accum = "";
index++;
encodedFormat[offset++] = DWFMT_upperCaseChar;
}
else if (currChar == "^")
{
if (accum != "")
encodedFormat[offset++] = accum;
accum = "";
index++;
encodedFormat[offset++] = DWFMT_lowerCaseChar;
}
else if (currChar == "#" || currChar == "0")
{
if (accum != "")
encodedFormat[offset++] = accum;
accum = "";
index++;
encodedFormat[offset++] = DWFMT_numberChar;
}
else if (currChar == "\\")
{
index++;
accum += inString.charAt(index++);
}
else if (currChar == "'")
{
index++;
while (index < strLen)
{
currChar = inString.charAt(index);
if (currChar == "'")
break;
accum += currChar;
index++;
}
// check if we fell off end before finding closing quotes
if (index == strLen)
bValid = false;

index++; // skip trailing '
}
else
{
accum += currChar;
index++;
}
}

if (accum != "")
encodedFormat[offset++] = accum;

if (encodedFormat.length == 0 )
bValid = false;

this.bValid = bValid;
}

function DW_StringFormatClass(formatString)
{
var semiOffset = formatString.indexOf(";");

if (semiOffset != -1)
{
this.mainFormat = new
DW_StringEncodingClass(formatString.substring(0, semiOffset));
this.nullFormat = new
DW_StringEncodingClass(formatString.substring(semiOffset+1,
formatString.length));

this.bValid = this.mainFormat.bValid &&
this.nullFormat.bValid;
}
else
{
this.mainFormat = new DW_StringEncodingClass(formatString);
this.nullFormat = null;
this.bValid = this.mainFormat.bValid;
}

}

function DW_FormatString(formatString, value, control)
{
var stringFormat = new DW_StringFormatClass(formatString);
var result = "";
var format;

if (stringFormat.bValid)
{
if (value == null && stringFormat.nullFormat != null)
format = stringFormat.nullFormat;
else
format = stringFormat.mainFormat;

var index;
var encodedFormat = format.encodedFormat;
var action;
var strIndex = 0;
var strLen;

// a length of -1 means that we will always put in " " chars
if (value != null)
strLen = value.length;
else
strLen = -1;

for (index=0; index < encodedFormat.length ; index++)
{
action = encodedFormat[index];
if (typeof action == "string")
result += action;
else if (action == DWFMT_allChars)
{
// get the rest
if (strIndex < strLen)
{
result += value.substring(strIndex, strLen);
strIndex = strLen;
}
}
else if (action == DWFMT_allChar)
{
if (strIndex < strLen)
result += value.charAt(strIndex);
else
result += " ";
strIndex++;
}
else if (action == DWFMT_stringChar)
{
if (strIndex < strLen &&
(DW_parseIsAlpha(value.charAt(strIndex)) ||
DW_parseIsDigit(value.charAt(strIndex))))
result += value.charAt(strIndex);
else
result += " ";
strIndex++;
}
else if (action == DWFMT_upperCaseChar)
{
if (strIndex < strLen &&
(DW_parseIsAlpha(value.charAt(strIndex)) ||
DW_parseIsDigit(value.charAt(strIndex)) ||
value.charAt(strIndex)==DW_decimalChar))
result += value.charAt(strIndex).toUpperCase();
else
result += " ";
strIndex++;
}
else if (action == DWFMT_lowerCaseChar)
{
if (strIndex < strLen &&
(DW_parseIsAlpha(value.charAt(strIndex)) ||
DW_parseIsDigit(value.charAt(strIndex)) ||
value.charAt(strIndex)==DW_decimalChar))
result += value.charAt(strIndex).toLowerCase();
else
result += " ";
strIndex++;
}
else if (action == DWFMT_numberChar)
{
if (strIndex < strLen &&
DW_parseIsDigit(value.charAt(strIndex)))
result += value.charAt(strIndex);
else
result += " ";
strIndex++;
}
}
}
else if ( value != null )
// Simulating a [general] format.
result = value;
else
result = "";

if (this.bStylePositioning && format && format.bValid)
if ( format.color == "" || typeof format.color == "string" )
control.style.color = format.color;
else
control.style.color = convertToRGB( format.color );

return result;
}

function DW_StringClass(str)
{
if (arguments.length == 0)
str = "";

this.str = str;
}

webDW_1.cols[2] = new HTDW_ColumnClass(2,
'dept_name',DW_StringParse,DW_IsString,null,null,null,'dept_name');
webDW_1.gobs.dept_name = new HTDW_ColumnGob('dept_name',2, 0, 0,
false, false, false, null, null, null, webDW_1.cols[2]);
webDW_1.cols[2].addDepend(new
HTDW_DependColumn(webDW_1.gobs.dept_name));
webDW_1.cols[3] = new HTDW_ColumnClass(3,
'dept_head_id',DW_IntParse,DW_IsNumber,null,null,null,'dept_head_id');
webDW_1.gobs.dept_head_id = new HTDW_ColumnGob('dept_head_id',3, 0,
0, false, false, false, null, null, null, webDW_1.cols[3]);
webDW_1.cols[3].addDepend(new
HTDW_DependColumn(webDW_1.gobs.dept_head_id));
</SCRIPT>
<TABLE CLASS=webDW-1197 STYLE="" BORDER=1 WIDTH=363>

<TR><TD WIDTH=66><TD WIDTH=231><TD WIDTH=66></TR>
<TR CLASS=webDW-1198 STYLE="">
<TH CLASS=webDW-1199 STYLE="; width:0.750in" onClick="{return
webDW_1.itemClicked(0,-1,'dept_id_t');}" >Dept Id</TH>
<TH CLASS=webDW-1199 STYLE="; width:2.563in" onClick="{return
webDW_1.itemClicked(0,-1,'dept_name_t');}" >Dept Name</TH>
<TH CLASS=webDW-1199 STYLE="; width:0.770in" onClick="{return
webDW_1.itemClicked(0,-1,'dept_head_id_t');}" >Dept Head Id</TH>
</TR>
<SPAN><SCRIPT LANGUAGE="JavaScript">
webDW_1.rows[0] = new HTDW_RowClass( "((1 0 '100'))",0,100,"R & D",
501);
</SCRIPT>
</SPAN><TR CLASS=webDW-1198 STYLE="">
<TD CLASS=webDW-119D STYLE="; width:0.750in" ALIGN=right><INPUT
TYPE="text" NAME="dept_id_0" SIZE=9 VALUE="100" CLASS=webDW-119D
TABINDEX=1 STYLE="; width:0.750in"
onFocus="{webDW_1.itemGainFocus(0,1,this,webDW_1.gobs.dept_id);}"
onClick="{var ret; ret= webDW_1.itemClicked(0,1,'dept_id'); return
ret;}" onChange="{this.bChanged = true;}"
onkeypress="DW_EditKeyPressed(-1)" onBlur="{webDW_1.itemLoseFocus
(this);}"></TD>
<TD CLASS=webDW-119E STYLE="; width:2.563in"><INPUT TYPE="text"
NAME="dept_name_0" SIZE=31 MAXLENGTH=40 VALUE="R &amp; D"
CLASS=webDW-119E TABINDEX=2 STYLE="; width:2.563in"
onFocus="{webDW_1.itemGainFocus(0,2,this,webDW_1.gobs.dept_name);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(0,2,'dept_name'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
<TD CLASS=webDW-119F STYLE="; width:0.770in" ALIGN=right><INPUT
TYPE="text" NAME="dept_head_id_0" SIZE=9 VALUE="501" CLASS=webDW-119F
TABINDEX=3 STYLE="; width:0.770in"
onFocus="{webDW_1.itemGainFocus(0,3,this,webDW_1.gobs.dept_head_id);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(0,3,'dept_head_id'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
</TR>
<SPAN><SCRIPT LANGUAGE="JavaScript">
webDW_1.rows[1] = new HTDW_RowClass( "((1 0 '200'))",0,200,"Sales",
902);
</SCRIPT>
</SPAN><TR CLASS=webDW-1198 STYLE="">
<TD CLASS=webDW-11A1 STYLE="; width:0.750in" ALIGN=right><INPUT
TYPE="text" NAME="dept_id_1" SIZE=9 VALUE="200" CLASS=webDW-11A1
TABINDEX=5 STYLE="; width:0.750in"
onFocus="{webDW_1.itemGainFocus(1,1,this,webDW_1.gobs.dept_id);}"
onClick="{var ret; ret= webDW_1.itemClicked(1,1,'dept_id'); return
ret;}" onChange="{this.bChanged = true;}"
onkeypress="DW_EditKeyPressed(-1)" onBlur="{webDW_1.itemLoseFocus
(this);}"></TD>
<TD CLASS=webDW-119E STYLE="; width:2.563in"><INPUT TYPE="text"
NAME="dept_name_1" SIZE=31 MAXLENGTH=40 VALUE="Sales" CLASS=webDW-119E
TABINDEX=6 STYLE="; width:2.563in"
onFocus="{webDW_1.itemGainFocus(1,2,this,webDW_1.gobs.dept_name);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(1,2,'dept_name'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
<TD CLASS=webDW-119F STYLE="; width:0.770in" ALIGN=right><INPUT
TYPE="text" NAME="dept_head_id_1" SIZE=9 VALUE="902" CLASS=webDW-119F
TABINDEX=7 STYLE="; width:0.770in"
onFocus="{webDW_1.itemGainFocus(1,3,this,webDW_1.gobs.dept_head_id);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(1,3,'dept_head_id'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
</TR>
<SPAN><SCRIPT LANGUAGE="JavaScript">
webDW_1.rows[2] = new HTDW_RowClass( "((1 0 '300'))",0,300,"Finance",
1293);
</SCRIPT>
</SPAN><TR CLASS=webDW-1198 STYLE="">
<TD CLASS=webDW-11A1 STYLE="; width:0.750in" ALIGN=right><INPUT
TYPE="text" NAME="dept_id_2" SIZE=9 VALUE="300" CLASS=webDW-11A1
TABINDEX=9 STYLE="; width:0.750in"
onFocus="{webDW_1.itemGainFocus(2,1,this,webDW_1.gobs.dept_id);}"
onClick="{var ret; ret= webDW_1.itemClicked(2,1,'dept_id'); return
ret;}" onChange="{this.bChanged = true;}"
onkeypress="DW_EditKeyPressed(-1)" onBlur="{webDW_1.itemLoseFocus
(this);}"></TD>
<TD CLASS=webDW-119E STYLE="; width:2.563in"><INPUT TYPE="text"
NAME="dept_name_2" SIZE=31 MAXLENGTH=40 VALUE="Finance"
CLASS=webDW-119E TABINDEX=10 STYLE="; width:2.563in"
onFocus="{webDW_1.itemGainFocus(2,2,this,webDW_1.gobs.dept_name);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(2,2,'dept_name'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
<TD CLASS=webDW-119F STYLE="; width:0.770in" ALIGN=right><INPUT
TYPE="text" NAME="dept_head_id_2" SIZE=9 VALUE="1293" CLASS=webDW-119F
TABINDEX=11 STYLE="; width:0.770in"
onFocus="{webDW_1.itemGainFocus(2,3,this,webDW_1.gobs.dept_head_id);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(2,3,'dept_head_id'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
</TR>
<SPAN><SCRIPT LANGUAGE="JavaScript">
webDW_1.rows[3] = new HTDW_RowClass( "((1 0 '400'))",
0,400,"Marketing",1576);
</SCRIPT>
</SPAN><TR CLASS=webDW-1198 STYLE="">
<TD CLASS=webDW-11A1 STYLE="; width:0.750in" ALIGN=right><INPUT
TYPE="text" NAME="dept_id_3" SIZE=9 VALUE="400" CLASS=webDW-11A1
TABINDEX=13 STYLE="; width:0.750in"
onFocus="{webDW_1.itemGainFocus(3,1,this,webDW_1.gobs.dept_id);}"
onClick="{var ret; ret= webDW_1.itemClicked(3,1,'dept_id'); return
ret;}" onChange="{this.bChanged = true;}"
onkeypress="DW_EditKeyPressed(-1)" onBlur="{webDW_1.itemLoseFocus
(this);}"></TD>
<TD CLASS=webDW-119E STYLE="; width:2.563in"><INPUT TYPE="text"
NAME="dept_name_3" SIZE=31 MAXLENGTH=40 VALUE="Marketing"
CLASS=webDW-119E TABINDEX=14 STYLE="; width:2.563in"
onFocus="{webDW_1.itemGainFocus(3,2,this,webDW_1.gobs.dept_name);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(3,2,'dept_name'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
<TD CLASS=webDW-119F STYLE="; width:0.770in" ALIGN=right><INPUT
TYPE="text" NAME="dept_head_id_3" SIZE=9 VALUE="1576" CLASS=webDW-119F
TABINDEX=15 STYLE="; width:0.770in"
onFocus="{webDW_1.itemGainFocus(3,3,this,webDW_1.gobs.dept_head_id);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(3,3,'dept_head_id'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
</TR>
<SPAN><SCRIPT LANGUAGE="JavaScript">
webDW_1.rows[4] = new HTDW_RowClass( "((1 0 '500'))",0,500,"Shipping",
703);
</SCRIPT>
</SPAN><TR CLASS=webDW-1198 STYLE="">
<TD CLASS=webDW-11A1 STYLE="; width:0.750in" ALIGN=right><INPUT
TYPE="text" NAME="dept_id_4" SIZE=9 VALUE="500" CLASS=webDW-11A1
TABINDEX=17 STYLE="; width:0.750in"
onFocus="{webDW_1.itemGainFocus(4,1,this,webDW_1.gobs.dept_id);}"
onClick="{var ret; ret= webDW_1.itemClicked(4,1,'dept_id'); return
ret;}" onChange="{this.bChanged = true;}"
onkeypress="DW_EditKeyPressed(-1)" onBlur="{webDW_1.itemLoseFocus
(this);}"></TD>
<TD CLASS=webDW-119E STYLE="; width:2.563in"><INPUT TYPE="text"
NAME="dept_name_4" SIZE=31 MAXLENGTH=40 VALUE="Shipping"
CLASS=webDW-119E TABINDEX=18 STYLE="; width:2.563in"
onFocus="{webDW_1.itemGainFocus(4,2,this,webDW_1.gobs.dept_name);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(4,2,'dept_name'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
<TD CLASS=webDW-119F STYLE="; width:0.770in" ALIGN=right><INPUT
TYPE="text" NAME="dept_head_id_4" SIZE=9 VALUE="703" CLASS=webDW-119F
TABINDEX=19 STYLE="; width:0.770in"
onFocus="{webDW_1.itemGainFocus(4,3,this,webDW_1.gobs.dept_head_id);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(4,3,'dept_head_id'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
</TR>
<SPAN><SCRIPT LANGUAGE="JavaScript">
webDW_1.rows[5] = new HTDW_RowClass( "((1 0 '3000'))",
0,3000,"testing",39933);
</SCRIPT>
</SPAN><TR CLASS=webDW-1198 STYLE="">
<TD CLASS=webDW-11A1 STYLE="; width:0.750in" ALIGN=right><INPUT
TYPE="text" NAME="dept_id_5" SIZE=9 VALUE="3000" CLASS=webDW-11A1
TABINDEX=21 STYLE="; width:0.750in"
onFocus="{webDW_1.itemGainFocus(5,1,this,webDW_1.gobs.dept_id);}"
onClick="{var ret; ret= webDW_1.itemClicked(5,1,'dept_id'); return
ret;}" onChange="{this.bChanged = true;}"
onkeypress="DW_EditKeyPressed(-1)" onBlur="{webDW_1.itemLoseFocus
(this);}"></TD>
<TD CLASS=webDW-119E STYLE="; width:2.563in"><INPUT TYPE="text"
NAME="dept_name_5" SIZE=31 MAXLENGTH=40 VALUE="testing"
CLASS=webDW-119E TABINDEX=22 STYLE="; width:2.563in"
onFocus="{webDW_1.itemGainFocus(5,2,this,webDW_1.gobs.dept_name);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(5,2,'dept_name'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
<TD CLASS=webDW-119F STYLE="; width:0.770in" ALIGN=right><INPUT
TYPE="text" NAME="dept_head_id_5" SIZE=9 VALUE="39933"
CLASS=webDW-119F TABINDEX=23 STYLE="; width:0.770in"
onFocus="{webDW_1.itemGainFocus(5,3,this,webDW_1.gobs.dept_head_id);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(5,3,'dept_head_id'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
</TR>
<SPAN><SCRIPT LANGUAGE="JavaScript">
webDW_1.rows[6] = new HTDW_RowClass( "((1 0 '4000'))",0,4000,"coba",
3993);
</SCRIPT>
</SPAN><TR CLASS=webDW-1198 STYLE="">
<TD CLASS=webDW-11A1 STYLE="; width:0.750in" ALIGN=right><INPUT
TYPE="text" NAME="dept_id_6" SIZE=9 VALUE="4000" CLASS=webDW-11A1
TABINDEX=25 STYLE="; width:0.750in"
onFocus="{webDW_1.itemGainFocus(6,1,this,webDW_1.gobs.dept_id);}"
onClick="{var ret; ret= webDW_1.itemClicked(6,1,'dept_id'); return
ret;}" onChange="{this.bChanged = true;}"
onkeypress="DW_EditKeyPressed(-1)" onBlur="{webDW_1.itemLoseFocus
(this);}"></TD>
<TD CLASS=webDW-119E STYLE="; width:2.563in"><INPUT TYPE="text"
NAME="dept_name_6" SIZE=31 MAXLENGTH=40 VALUE="coba" CLASS=webDW-119E
TABINDEX=26 STYLE="; width:2.563in"
onFocus="{webDW_1.itemGainFocus(6,2,this,webDW_1.gobs.dept_name);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(6,2,'dept_name'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
<TD CLASS=webDW-119F STYLE="; width:0.770in" ALIGN=right><INPUT
TYPE="text" NAME="dept_head_id_6" SIZE=9 VALUE="3993" CLASS=webDW-119F
TABINDEX=27 STYLE="; width:0.770in"
onFocus="{webDW_1.itemGainFocus(6,3,this,webDW_1.gobs.dept_head_id);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(6,3,'dept_head_id'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
</TR>
<SPAN><SCRIPT LANGUAGE="JavaScript">
webDW_1.rows[7] = new HTDW_RowClass( "((1 0 '4001'))",0,4001,"dkdfj",
393);
</SCRIPT>
</SPAN><TR CLASS=webDW-1198 STYLE="">
<TD CLASS=webDW-11A1 STYLE="; width:0.750in" ALIGN=right><INPUT
TYPE="text" NAME="dept_id_7" SIZE=9 VALUE="4001" CLASS=webDW-11A1
TABINDEX=29 STYLE="; width:0.750in"
onFocus="{webDW_1.itemGainFocus(7,1,this,webDW_1.gobs.dept_id);}"
onClick="{var ret; ret= webDW_1.itemClicked(7,1,'dept_id'); return
ret;}" onChange="{this.bChanged = true;}"
onkeypress="DW_EditKeyPressed(-1)" onBlur="{webDW_1.itemLoseFocus
(this);}"></TD>
<TD CLASS=webDW-119E STYLE="; width:2.563in"><INPUT TYPE="text"
NAME="dept_name_7" SIZE=31 MAXLENGTH=40 VALUE="dkdfj" CLASS=webDW-119E
TABINDEX=30 STYLE="; width:2.563in"
onFocus="{webDW_1.itemGainFocus(7,2,this,webDW_1.gobs.dept_name);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(7,2,'dept_name'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
<TD CLASS=webDW-119F STYLE="; width:0.770in" ALIGN=right><INPUT
TYPE="text" NAME="dept_head_id_7" SIZE=9 VALUE="393" CLASS=webDW-119F
TABINDEX=31 STYLE="; width:0.770in"
onFocus="{webDW_1.itemGainFocus(7,3,this,webDW_1.gobs.dept_head_id);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(7,3,'dept_head_id'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
</TR>
<SPAN><SCRIPT LANGUAGE="JavaScript">
webDW_1.rows[8] = new HTDW_RowClass( "((1 0 '5000'))",0,5000,"39933",
3);
</SCRIPT>
</SPAN><TR CLASS=webDW-1198 STYLE="">
<TD CLASS=webDW-11A1 STYLE="; width:0.750in" ALIGN=right><INPUT
TYPE="text" NAME="dept_id_8" SIZE=9 VALUE="5000" CLASS=webDW-11A1
TABINDEX=33 STYLE="; width:0.750in"
onFocus="{webDW_1.itemGainFocus(8,1,this,webDW_1.gobs.dept_id);}"
onClick="{var ret; ret= webDW_1.itemClicked(8,1,'dept_id'); return
ret;}" onChange="{this.bChanged = true;}"
onkeypress="DW_EditKeyPressed(-1)" onBlur="{webDW_1.itemLoseFocus
(this);}"></TD>
<TD CLASS=webDW-119E STYLE="; width:2.563in"><INPUT TYPE="text"
NAME="dept_name_8" SIZE=31 MAXLENGTH=40 VALUE="39933" CLASS=webDW-119E
TABINDEX=34 STYLE="; width:2.563in"
onFocus="{webDW_1.itemGainFocus(8,2,this,webDW_1.gobs.dept_name);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(8,2,'dept_name'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
<TD CLASS=webDW-119F STYLE="; width:0.770in" ALIGN=right><INPUT
TYPE="text" NAME="dept_head_id_8" SIZE=9 VALUE="3" CLASS=webDW-119F
TABINDEX=35 STYLE="; width:0.770in"
onFocus="{webDW_1.itemGainFocus(8,3,this,webDW_1.gobs.dept_head_id);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(8,3,'dept_head_id'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
</TR>
<SPAN><SCRIPT LANGUAGE="JavaScript">
webDW_1.rows[9] = new HTDW_RowClass( "((1 0 '3993'))",0,3993,"39393",
3);
</SCRIPT>
</SPAN><TR CLASS=webDW-1198 STYLE="">
<TD CLASS=webDW-11A1 STYLE="; width:0.750in" ALIGN=right><INPUT
TYPE="text" NAME="dept_id_9" SIZE=9 VALUE="3993" CLASS=webDW-11A1
TABINDEX=37 STYLE="; width:0.750in"
onFocus="{webDW_1.itemGainFocus(9,1,this,webDW_1.gobs.dept_id);}"
onClick="{var ret; ret= webDW_1.itemClicked(9,1,'dept_id'); return
ret;}" onChange="{this.bChanged = true;}"
onkeypress="DW_EditKeyPressed(-1)" onBlur="{webDW_1.itemLoseFocus
(this);}"></TD>
<TD CLASS=webDW-119E STYLE="; width:2.563in"><INPUT TYPE="text"
NAME="dept_name_9" SIZE=31 MAXLENGTH=40 VALUE="39393" CLASS=webDW-119E
TABINDEX=38 STYLE="; width:2.563in"
onFocus="{webDW_1.itemGainFocus(9,2,this,webDW_1.gobs.dept_name);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(9,2,'dept_name'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
<TD CLASS=webDW-119F STYLE="; width:0.770in" ALIGN=right><INPUT
TYPE="text" NAME="dept_head_id_9" SIZE=9 VALUE="3" CLASS=webDW-119F
TABINDEX=39 STYLE="; width:0.770in"
onFocus="{webDW_1.itemGainFocus(9,3,this,webDW_1.gobs.dept_head_id);
webDW_1.selectControlContent(this);}" onClick="{var ret; ret=
webDW_1.itemClicked(9,3,'dept_head_id'); return ret;}"
onChange="{this.bChanged = true;}" onkeypress="DW_EditKeyPressed(-1)"
onBlur="{webDW_1.itemLoseFocus (this);}"></TD>
</TR>
</TABLE>
<SCRIPT LANGUAGE="JavaScript">

webDW_1.firstRow = 0;
webDW_1.lastRow = 10 - 1;
webDW_1.bSingleRow = (webDW_1.firstRow == webDW_1.lastRow);
webDW_1.dataForm = document.webDW_1_dataForm;
</SCRIPT>

<!-- This script code is automatically generated - do not modify! -->
<SCRIPT language="JavaScript">
var ls_rowElement


function highlightRow (ls_rowElement)
{

ls_rowElement.style.background = "#99ccff";

}

function webDW_1_Clicked(row, objectName)
{

ls_rowElement = event.srcElement.parentElement.parentElement;
highlightRow (ls_rowElement)

}

</SCRIPT>

&nbsp;
<P>&nbsp;</P>
</FORM>
<SCRIPT LANGUAGE="JavaScript">
psPage.dataForm = document.__dataForm;
psPage.webDW_1 = webDW_1;
webDW_1.dataForm = psPage.dataForm;
function psPage___OnLoad() {
}
psPage.OnLoad = psPage___OnLoad;
</SCRIPT>
</BODY>
</HTML>

thank you for your advice.

best regards,

alim


On May 31, 1:06 am, "Rahul Jain" <jainrahul...@gmail.com> wrote:
> Sure... send it via email - remove Xs from my email ID. I do not need the
> JSP source, I need the HTML source (View Source from your browser).
>
> Rahul
>

> "alim" <alfen_...@yahoo.com> wrote in message
>

> ...
>
> read more ยป- Hide quoted text -

Jim Egan

unread,
Jul 11, 2007, 10:30:07โ€ฏPM7/11/07
to
alfe...@yahoo.com wrote...

Going a ways back here, but I thought I would throw in my 2 cents. To implement this I
used the existing classes of the DW rows and added an additional one in my JSP. The new
class was for the highlighted row. When the user clicked on a row I changed the class of
the span for the that row to my highlighted row class. When the user clicked to a
different row I had to make sure the old row was changed back to use the original class so
it didn't show up as highlighted. This only works for certain DW types (I.e. tabular).
--
Jim Egan [TeamSybase - Retired]

0 new messages