?
Solved

Populating dropdown box on pageload

Posted on 2008-10-29
3
Medium Priority
?
781 Views
Last Modified: 2013-11-18
I have attached the javascript code,I am calling reqLocInit() method in an xsl file on body load as
<body onload="profile_init();reqLocInit()" 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;left:0;top:0;height:100%;width:100%;visibility:hidden;border:0px;" src="../blank.htm"></iframe>
-->
<iframe id="hiddenFrame" frameborder="0" style="position:absolute;left:0;top:450;height:100%;width:100%;border:0px;" src="../blank.htm"></iframe>
 
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-LOCATION</xsl:with-param>
                        </xsl:call-template>
                        </label>
                  </td>
which is AFTER the body tag completes
the body tags starts and ends as
<body onload="profile_init();reqLocInit()" onkeydown="profile_keydown(event)" onunload="profile_unload()" style="visibility:hidden">
                        <div id="profileTabGroup" class="hiddenTabGroup">
                              <ul>
                                    <li id="profileTab">
                                          <button onclick="mainWnd.sipObj.showTabGroup('profile', workWnd)"
                                                      onmouseover="changeObjClass(this,'over');"
                                                      onmouseout="restoreObjClass(this);">
                                                <xsl:call-template name="doThatLangThing">
                                                      <xsl:with-param name="langVar">profile</xsl:with-param>
                                                </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/ItemGroup/ID"/></xsl:attribute>
                                          </input>
                                          <input name="_vendorGroup" type="hidden">
                                                <xsl:attribute name="value"><xsl:value-of select="DefaultsScreen/VendorGroup/ID"/></xsl:attribute>
                                          </input>
                                          <input name="_procureGroup" type="hidden">
                                                <xsl:attribute name="value"><xsl:value-of select="DefaultsScreen/ProcureGroup/ID"/></xsl:attribute>
                                          </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;
}

Open in new window

0
Comment
Question by:akohli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
scrathcyboy earned 2000 total points
ID: 22837939
You CANNOT insert part of a table AFTER the body tag completes.  It MUST be inserted into the BODY to make valid HTML.  You will either have to not close out the BODY and HTML before you insert the table, or else put the table, starting and ending with the <TABLE>  and </TABLE> tags, into the XSL code.
0
 

Author Comment

by:akohli
ID: 22843014
i got this done ,i was able to populate the droppdown box with values but now the problem is it is not picking up the selected value ,what i need to do is to add that selected value to the hidden text box how do i do that.I did this for populating the dropdown
<td>

    <select name="RQH_REQ_LOCATION" id="RQH_REQ_LOCATION" disabled="true"/>
    <iframe id="REQLOCHID" frameborder="0" style="position:absolute;left:0;top:450;height:100%;width:100%;border:0px;" src="../blank.htm"></iframe>
   
</td>
How to get the selected value to the hidden text box
0
 

Author Comment

by:akohli
ID: 22843062
and also i would like to send the default value to the text box
0

Featured Post

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question