akohli
asked on
Populating dropdown box on pageload
I have attached the javascript code,I am calling reqLocInit() method in an xsl file on body load as
<body onload="profile_init();req LocInit()" onkeydown="profile_keydown (event)" onunload="profile_unload() " style="visibility:hidden">
The thing is i need to insert html code <form action="" method="post">
<b>Requesting Locations:</b>
<select name="reqLoc" disabled="true">
</select>
<br />
</form>
</p>
<!--
<iframe id="hiddenFrame" frameborder="0" style="position:absolute;l eft:0;top: 0;height:1 00%;width: 100%;visib ility:hidd en;border: 0px;" src="../blank.htm"></ifram e>
-->
<iframe id="hiddenFrame" frameborder="0" style="position:absolute;l eft:0;top: 450;height :100%;widt h:100%;bor der:0px;" src="../blank.htm"></ifram e>
in to this xsl,I checked on internet that this code should be included with in body but i have to insert somewhere after this
<tr>
<td class="fieldlabel" elementType="field">
<label for="RQH_REQ_LOCATION">
<xsl:call-template name="doThatLangThing">
<xsl:with-param name="langVar">RQH-REQ-LOC ATION</xsl :with-para m>
</xsl:call-template>
</label>
</td>
which is AFTER the body tag completes
the body tags starts and ends as
<body onload="profile_init();req LocInit()" onkeydown="profile_keydown (event)" onunload="profile_unload() " style="visibility:hidden">
<div id="profileTabGroup" class="hiddenTabGroup">
<ul>
<li id="profileTab">
<button onclick="mainWnd.sipObj.sh owTabGroup ('profile' , workWnd)"
onmouseover="changeObjClas s(this,'ov er');"
onmouseout="restoreObjClas s(this);">
<xsl:call-template name="doThatLangThing">
<xsl:with-param name="langVar">profile</xs l:with-par am>
</xsl:call-template>
</button>
</li>
<div class="contentArea">
<!-- Profile ************************** ********** ********** ********** ********** ********** ********** *** -->
<div id="profile" style="display:none">
<form name="profiler" id="profiler" onsubmit="return false;">
<table align="left" border="0" cellpadding="2" cellspacing="2">
<xsl:call-template name="profileFields"/>
</table>
<input name="_itemGroup" type="hidden">
<xsl:attribute name="value"><xsl:value-of select="DefaultsScreen/Ite mGroup/ID" /></xsl:at tribute>
</input>
<input name="_vendorGroup" type="hidden">
<xsl:attribute name="value"><xsl:value-of select="DefaultsScreen/Ven dorGroup/I D"/></xsl: attribute>
</input>
<input name="_procureGroup" type="hidden">
<xsl:attribute name="value"><xsl:value-of select="DefaultsScreen/Pro cureGroup/ ID"/></xsl :attribute >
</input>
</form>
</div>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>
</xsl:template>
How do i do this?
<body onload="profile_init();req
The thing is i need to insert html code <form action="" method="post">
<b>Requesting Locations:</b>
<select name="reqLoc" disabled="true">
</select>
<br />
</form>
</p>
<!--
<iframe id="hiddenFrame" frameborder="0" style="position:absolute;l
-->
<iframe id="hiddenFrame" frameborder="0" style="position:absolute;l
in to this xsl,I checked on internet that this code should be included with in body but i have to insert somewhere after this
<tr>
<td class="fieldlabel" elementType="field">
<label for="RQH_REQ_LOCATION">
<xsl:call-template name="doThatLangThing">
<xsl:with-param name="langVar">RQH-REQ-LOC
</xsl:call-template>
</label>
</td>
which is AFTER the body tag completes
the body tags starts and ends as
<body onload="profile_init();req
<div id="profileTabGroup" class="hiddenTabGroup">
<ul>
<li id="profileTab">
<button onclick="mainWnd.sipObj.sh
onmouseover="changeObjClas
onmouseout="restoreObjClas
<xsl:call-template name="doThatLangThing">
<xsl:with-param name="langVar">profile</xs
</xsl:call-template>
</button>
</li>
<div class="contentArea">
<!-- Profile **************************
<div id="profile" style="display:none">
<form name="profiler" id="profiler" onsubmit="return false;">
<table align="left" border="0" cellpadding="2" cellspacing="2">
<xsl:call-template name="profileFields"/>
</table>
<input name="_itemGroup" type="hidden">
<xsl:attribute name="value"><xsl:value-of
</input>
<input name="_vendorGroup" type="hidden">
<xsl:attribute name="value"><xsl:value-of
</input>
<input name="_procureGroup" type="hidden">
<xsl:attribute name="value"><xsl:value-of
</input>
</form>
</div>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>
</xsl:template>
How do i do this?
r.js file
var reqLocProdLine = "LOGAN";
var reqLocFile = "WFUSERCAT";
var workCat = "Req Loc";
function reqLocInit() {
alert(mainWnd.user.requester);
//Now get the WF USER CATEGORY Table for processing
REQLOC = new Array();
var dmeObject = new DMEObject(reqLocProdLine, reqLocFile);
//Need to change the name of the servlet to include the .exe as otherwise apache misses the reference
dmeObject.progName="/cgi-lawson/dme.exe";
dmeObject.field="Id;Task;Work-category;Work-cat-value";
dmeObject.out="JAVASCRIPT";
dmeObject.max="1000";
dmeObject.select="Id=" + mainWnd.user.requester + "&Work-category=Req Loc";
dmeObject.func="setReqLocList()";
DME(dmeObject,"REQLOCHID");
}
function setReqLocList() {
REQLOC = window.REQLOCHID.record
for (var i=0; i<REQLOC.length; i++) {
var newOption=document.createElement('option');
newOption.text=REQLOC[i].Work_cat_value
var reqLocSelect=document.getElementById("RQH_REQ_LOCATION");
try
{
reqLocSelect.add(newOption,null); // standards compliant
}
catch(ex)
{
reqLocSelect.add(newOption); // IE only
}
}
document.getElementById("RQH_REQ_LOCATION").disabled = false;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
and also i would like to send the default value to the text box
ASKER
<td>
<select name="RQH_REQ_LOCATION" id="RQH_REQ_LOCATION" disabled="true"/>
<iframe id="REQLOCHID" frameborder="0" style="position:absolute;l
</td>
How to get the selected value to the hidden text box