Display Javascript array value OnChange instead of Bean value
I intially loop through a collection of employees display the values within the employee loop I have a select statement that i loop through a collection of programs that has on OnChange. I want to display the javascript value instead of the bean value onChange. The following code displays the bean value initally and onChange it displays both because the if is never false?
*<c:if test="${programs[programIndex] != emps.department}">${emps.department}</c:if>*
* <div id="programText"> </div>*
* <input name="department" type="hidden" id="department">*
JSP page
<jsp:useBean id="programs" scope="request" class="java.util.Collection"/>
<jsp:useBean id="employeeList" scope="request" class="java.util.Collection"/>
<script language="JavaScript" type="text/javascript">
var programs = new Array();
function setProgramFields() {
nameField = document.getElementById("programList");
idx = nameField.selectedIndex;
emField = document.getElementById("programText");
emHiddenField = document.getElementById("department");
emField.innerHTML = programs[idx];
emHiddenField.value = programs[idx];
<c:forEach var="emps" items="${employeeList}">
<td width="170px">
*<c:if test="${programs[programIndex] != emps.department}">${emps.department}</c:if>*
* <div id="programText"> </div>*
* <input name="department" type="hidden" id="department">*
</td>
<td width="275px">
<div class="selectBorder">
<select name="programName" type="text" class="searchProgram" id="programList" onChange="setProgramFields()">
<c:set var="programIndex" value="0"/>
<c:forEach var="sp" items="${programs}">
<c:if test="${sp.programName == emps.programName}">
<option value="${emps.programName}" selected="selected">${emps.programName}</option>
</c:if>
<c:if test="${sp.programName != emps.programName}">
<option value="${sp.programName}">${sp.programName}</option>
</c:if>
<script language="JavaScript" type="text/javascript">
programs[${programIndex}] = "${sp.department}";
</script>
<c:set var="programIndex" value="${programIndex + 1}"/>
</c:forEach>
</select>
</div>
</td>
</c:forEach>
Edited by: kmb_ms on Sep 15, 2008 2:38 PM
Apologize for not formatting the code. I used the status.index the code as suggested. The code if more efficient but the results are the same and I still have the same problem.
<select name="programName" type="text" class="searchProgram" id="programList" onChange="setProgramFields()">
<c:forEach var="sp" items="${programs}" varStatus="status">
<c:if test="${sp.programName == emps.programName}">
<option value="${emps.programName}" selected="selected">${emps.programName}</option>
</c:if>
<c:if test="${sp.programName != emps.programName}">
<option value="${sp.programName}">${sp.programName}</option>
</c:if>
<script language="JavaScript" type="text/javascript">
departments[${status.index}] = "${sp.department}";
</script>
</c:forEach>
</select> How can I access the value of the array to compare with the value of the bean.
<script language="JavaScript" type="text/javascript">
var departments = new Array();
function setProgramFields() {
nameField = document.getElementById("programList");
idx = nameField.selectedIndex;
emField = document.getElementById("departmentText");
emHiddenField = document.getElementById("department");
emField.innerHTML = departments[idx];
emHiddenField.value = departments[idx];
</script>The following code displays both the value of the bean and the value of the array onChange b/c the if statement is always true???? This is where I need help.
<td width="170px">
<c:if test="${departments[idx] != emps.department}">${emps.department}</c:if>
<div id="departmentText"> </div>
<input name="department" type="hidden" id="department">
</td>
Similar Messages
-
Display or array values all on one line
This is my code it gives a strange out come!!!, how do I display the values of the array?
System.out.println("hi " + array2[0] + array2[1] + array2[2] + array2[3] + array2[4]);Lemme help you out
'-.\|':':' `"` ':':'|/.-'
`-./`. .-=-. .-=-. .`\.-`
/=- / | \ -=\
; | | | ;
|=-.|______|______|.-=|
|== \ 0 /_\ 0 / ==|
|= /'---( )---'\ =|
`\= '--` `--' =/'
`-=._ _.=-'
`"""` -
Hi !
All I just want to do is to look for a bean value stored into an array, dynamically.
The final code should be something like :
<% for( int i = 0; i < 10; i++ ) { %>
<h:outputText value="#{foo.bar[<%=i%>]}" />
<% } %>Obviously this doesn't work, but how is it possible to make it work ? ^^
10 Duke Dollars for the first one who answers :)Ok, actually it doesn't work at all...
From Oracle ADF Faces FAQ :
ADF Faces tags can be used inside of the < af:forEach > tag (it is, unfortunately, not possible to support standard tags inside < af:forEach > ).
It appears it's the same issue as with JSTL...
Does anybody know another way to do that ?
Is it really impossible to include code like <%= i %> ??
Is it simply impossible to do what i want... -
What is the best way to display different array values to appropriate indicators?
I am using DAQmx Read vi and its output is an array. I need a way to pass each value to an appropriate front panel indicator, so I can monitor each sensor. I tried using "Index Array" and passing the array element to the indicators but it looks sloppy. Is there a more professional way? Thanks!
Attachments:
Mole.vi 215 KBTry using the Array to Cluster function in the Cluster subpallet. If you put all of your indicators in the same cluster on your front panel, you can then pass the array data to this function and then pass it directly to the cluster without having to index the array.
criag -
Javascript array / jsp Bean Collection
How can you fill a javascript array with the values of the collection?
<jsp:useBean id="programs" scope="request" class="java.util.Collection"/>
How can I create this array?
<script language="JavaScript" type="text/javascript">
var programData =
new Array ( new Array "${programs[1].programId}","${programs[1].programName}", "${programs[1].department}"),
new Array "${programs[2].programId}","${programs[2].programName}", "${programs[2].department}"),
</script>I answered myself. If anyone else would like to know how to fill a javascript array with the values of a jsp beans collection.
function collectionToArray()
Array[rows] = [4];
var cnt = 0;
<c:forEach var="sp" items="${programs}">
rows[cnt][0] = ${sp.programId};
rows[cnt][1] = ${sp.programName};
rows[cnt][2] = ${sp.department};
rows[cnt][3] = ${sp.urlLink1};
rows[cnt][4] = ${sp.urlLink2};
cnt++;
</c:forEach>
} -
How do I display array values in a text field?
Hi there-
I have a small Flash movie I'm trying to complete, it's my
first go around with Flash 8 so I appreciate your patience:
I built an array with some actionscript which seems to work
fine (I can trace it and all is well in the trace window). Now I'm
simply trying to display it to my Flash movie screen and I've built
a dynamic text window which is working, except that I only ever get
the last array element to appear in the dynamic text window. I've
traced the code and see all of my array values, but when I use
"myResults_txt.text=picker_array;" I only see the last position's
value in my array. I tried playing with the "multiline" attribute
for the text field, it didn't seem to make any difference.
I'm sure it's probably something silly that I've missed, but
how do you display an array, with all of it's values to a dynamic
text field (I even tried using the textArea component but ran into
the same problem).
Thanks in advance for any help-
richThanks for your input. I tried just about everything but
ended up re-writing the contents of the array to a var and looping
through the var. Not my first choice but it got me to done.
Thanks again,
Rich -
I found this fantatic post regarding querying the user profile service
http://blogs.technet.com/b/anneste/archive/2011/11/02/how-to-create-an-infopath-form-to-auto-populate-data-in-sharepoint-2010.aspx?pi47623=2#comments
However i have an issue whenever the form is opened again either to view or edit, it displays the current users information
instead of the value of the person who completed the form in the first place.
Please help me, I'm turning more grey each minuteI think it is how the current user information is stored based on your logic.
You might be quering current value again when loading the form (Form load Rule).
you have to tweak your logic, after the user submits the form you can set the username to the one who saved it.
or in form load, write a logic to see if the form was not saved before and then query the username( by using internal field like "formstatue")
Hope this helps!
Ram - SharePoint Architect
Blog - SharePointDeveloper.in
Please vote or mark your question answered, if the reply helps you -
How to display array values in textfield?
i am creating student details with mysql database using JSON to get values and display in xcode.i got json array values from php and converted to NSMuatable array. my array result
firstName = hari;
lastname = krishna;
age=10;
fathername=ragav;
firstName = priya;
lastname = amirtha;
age=8;
fathername=ravi;
now i want to display values iwhen i am enter firstname other field values display in textfiled on button click.how to do that .help me .thanks in advance.
i am very new to xcode.Hi,
I think that its necessaries to use AJaX.
I am implemeting something like that.
I have a input text that works like a filter and depends on what my user types in input text I populate my table with some information.
In order to do that, I put in my JSP a div with an Id and I used ajax, like that:
function ajaxFunction()
var xmlhttp;
if (window.XMLHttpRequest)
xmlhttp=new XMLHttpRequest();
else if (window.ActiveXObject)
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
else
alert("Your browser does not support XMLHTTP!");
xmlhttp.onreadystatechange=function()
if( xmlhttp.readyState==4 )
document.getElementById("tabelaResponsaveis").innerHTML = xmlhttp.responseText;
var resp = "<f:invokeUrl var='solicitacao' methodName='getResponsaveis'/>";
xmlhttp.open("POST",resp,true);
xmlhttp.send(null);
getResponsaveis is a method inside my BPM that returns a HTML code (the table HTML code with all the information that I need to show.
I Hope to help
Thanks Marcos -
How to display only Day value instead of DATE in Bex Report
Hi Experts,
We have a Month to date Report, in this report we need to display only day value instead of DATE value,
Like
if Date is 14.05.2010 we need to show only 14
Regards,
ChandraHi ,
Thanks for Quick Response
we does have the option to create the char(calday or ...) value variable replacement with char (calday or ...) info object, we can replace with Report r variable value only not with info object.
i hope we can replace the with info object only with formula variable with replacement.
My BEx Report is Designed like
Columns
0Calday
Rows
Plant
Keyfigures
Actual
Plan
Report output Looks like month to date
0CALDAY 01.06.2010 02.06.2010 03.06.2010
P1 ACTUAL 10 8 4
P1 PLAN 15 6 2
P2 ACTUAL 5 10 7
P2 PLAN 4 8 3
Report should be
0CALDAY 1 2 3
P1 ACTUAL 10 8 4
P1 PLAN 15 6 2
P2 ACTUAL 5 10 7
P2 PLAN 4 8 3
please let me know how can i achive this
Regards
Chandra -
Populating a javascript array with datatable data
I want to populate a javascript array with datatable data.
How do I do this?
I want the javascript array to be populated as the datatable is displayed.
Doing this way doesn't work.
<h:dataTable value="#{pmManager.profiles}" var="pmProfile" binding="#{pmManagerUiBean.uiTable}" ">
<script>
allProfilenames[index]='#{pmProfile.profileName}';
alert("index ="+index);
alert("...1"+allProfilenames[0]);
alert("...2"+allProfileRes[0]);
index++;
</script>
<h:dataTable>In Javascript do something like this:
document.getElementById('form1:dec_param');
where form1:dec_param is the id of the component on the page source (html) -
Stalling a form from loading until the initial javascript arrays are loaded
I am looking for a way to get a form to be hidden based on the onload event. I would like to call a javascript function to initially populate some select boxes based on javascript arrays, but I would like this to happen before the page loads or at least stall displaying the select boxes until they are populated.
The way it is setup now, when the page loads, the select boxes try to load first and then the rest of the form loads. I would like to know if there is a way to load the select boxes from the javascript arrays, then have the select boxes and other form elements show up at the same time. I have tried putting a <div> around the entire form and within the javascript populate function I first use "document.formname.div_id.style.visibility=hidden" then at the end of the select box population within the function, I use "document.formname.div_id.style.visiblity=visible". I tried this and the select boxes appear blank; it is as if the populate function doesn't work at all.
I realize this is a very long question, but I will award you Duke Dollars if you help me out!!!right now, I have it set up where I click on a link which is a jsp page which forwards me to the jsp page that has all the html in it. That page is where I initially try to populate the select boxes with the javscript arrays...I also have a number of javascript functions which change the contents of the select boxes based on another select box in the form. Will i have access to those "java" arrays, [instead of using the javascript arrays], that you are suggesting in the javascript code? I do need to use whatever arrays I create in javascript functions.
-
SelectOneChoice VO: Javascript Array
Hello,
Is there a way to create an array in javascript that would contain all of the values in a SelectOneChoice component? I tried:
document.getElementById("form1:selectOneChoice1").value()
but it doesn't like that. error:(object does not support this action)
I bound the value of the SelectOneChoice component to the value of an InputText and it just gives me the position of the value in the SelectOneChoice array.
#{backing_Test.selectOneChoice1.value}
I want the actual value in the selectonechoice box, not the position.
Any ideas?
Thanks,
Timhttp://209.85.135.104/search?q=cache:_KBQY88SdGAJ:java2go.blogspot.com/2007/08/mastering-adf-faces-component.html+javascript+get+value+from+selectOneChoice&hl=en&ct=clnk&cd=4&gl=us&client=firefox-a
The above link solves part of the problem.
If you do this in javascript:
alert(document.getElementById('form:selectOneChoice').options[0].value);
Where 0 is the selectItem index, it will return you the value...
But it is always a number value instead of the database object name like I want.
I need help with this as well. -
Unable to display a variable value in xml through xsl using coldfusion
Hi ColdFusion Heroes ,
Is their any one to help me in this issue . I am new to cold
fusion , XML and XSL .
Detail Explaination :
develoment_files.cfm is a .cfm page , which includes an xml
page .
development_files_dropdown.xsl is a xsl page .
develoment_files.cfm : Code is as follows .
<CFDIRECTORY ACTION="LIST" DIRECTORY="#somepath#"
NAME="DirContents" FILTER="p*">
<CFQUERY DBTYPE="query" NAME="Files">
SELECT *
FROM DirContents
WHERE Type = 'File'
</CFQUERY>
<CFOUTPUT><?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type="text/xsl"
href="../XSL/development_files_dropdown.xsl"?>
<Test xmlns:xsi='
http://www.w3.org/2001/XMLSchema-instance'>
<CFLOOP QUERY="Files">
<Directory>
<DisplayName>#Name#</DisplayName>
<FullPath>#Name#</FullPath>
</Directory>
</cfloop>
</Test></CFOUTPUT>
This file generates a query resulting files starting with p*
and then it should be a file and manipulates in xml.
development_files_dropdown.xsl pages is as follows.
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:preserve-space elements="*"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="Test">
<B>Script Name: </B>
<select name="T1_Dev_Script" CLASS="DevInput">
<xsl:for-each select="Directory">
<option>
<xsl:attribute name="value">
<xsl:value-of select="FullPath/text()"/>
</xsl:attribute>
<xsl:value-of select="DisplayName/text()"/>
</option>
</xsl:for-each>
</select>
</xsl:template>
</xsl:stylesheet>
This is only for the purpose of display .
Now i want to get one particular file named "pfile" { Code is
written in development_files.cfm page and kept it in a variable } I
want to display it in #Name# filed. how can i do that ? I am
getting XML Parsing error from javascript .
Could any one look into this .
Thanks & Regards,
Nataraj GThe first part is right -
1) drag a text element onto the page, at a location in which you want the variable value to be displayed
2) On the left hand bottom page - go to the web item properties for the text element
3) scroll down to the specific properties for the item - in that uncheck the first two check boxes - display general text elements & display static filter values
4) in the next item in the properties (List of text elements) click once on the box where List is written and then clcik on the small browse button that appears.
5) in the window that opens, in the element type field, select variable/variable value as key (as per your requirement) and then under the element ID field type in the technical name of your variable that you want to display.
click ok and save your template and try executing it.
See if this solves your problem.
regards,
Nikhil -
Assign a Javascript variable value to a ABAP variable
Hi,
I wish to assign a javascript variable value to a ABAP variable. Any ideas how to do that?
Many thanks.
Rgds,
BerniceHere's another suggestion for you.
BSP Application: SBSPEXT_HTMLB
Check out the radionbuttongroup.bsp
So then instead of using a standard HTML radio buttons you can use the HTMLB element with the parameter for onClick set then in your DO_HANDLE_EVENT you can read the value.
VIEW
<htmlb:radioButtonGroup id="radio">
<htmlb:radioButton id="id_link"
text="Link"
onClick="myClickHandler"/>
<htmlb:radioButton id="id_unlink"
text="Unlink"
onClick="myClickHandler"/>
</htmlb:radioButtonGroup>
DO_HANDLE_EVENT
DATA: lt_event TYPE REF TO if_htmlb_data.
lt_event = cl_htmlb_manager=>get_event_ex( request ).
if lt_event IS NOT INITIAL.
if lt_event->event_name = htmlb_events=>radiobutton.
case lt_event->event_id.
when 'control_id_link'.
schalter = ' '..
when 'control_id_unlink'.
schalter = '1'.
endcase.
endif.
endif.
There is an example of how to use it and read it in the DO_HANDLE_EVENT you then just have to pass the variable around (in this example the variable name is schalter and is defined as char1 in the class) -
How to Display Parent Form Values in Child Form
Hi,
I have Order Page and Item Page
In the order Page If I select any Item and click on Submit Button, It should open Item Page and results should display in advance table region. In my Item page i have header region(Default double) with 3 fields (dummy) like
Item
Description
org
Now my question is I need to display the Item Value in the Item Page Header region in the Item Column which I was selecting in the Order Page.
I have an order 100 with item A, B , C I select B and click on submit It should open Item Page and in items page i have a column called Item and the value B sholud be populated.
Thanks,
MaheshHello Ajay,
Thanks for your reply..
What Iam doing is Iam capturin the values in session variables like below when submit button is clicked
pageContext.putSessionValue("SItemNo",ItemNo);
And when my item page is opening I need to set this value to that VO Attribute..
Iam trying the below way to set the attr value in PR
String SItemNo=(String) pageContext.getSessionValue("SItemNo");
OAMessageTextInputBean oa = (OAMessageTextInputBean)webBean.findChildRecursive("ItemNo");
oa.setAttributeValue(SItemNo);
But it is giving compilation error
Error(35,9): method setAttributeValue(java.lang.String) not found in class oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean
Please correct me ajay.
Thanks,
Maybe you are looking for
-
Unable to install OS 10.3 on my tray loaded Imac 233 MHz Powerpc 750.
03Jan07 I am not able to install OS 10.3 on to my 10 GB hard drive. I get this message: "You can not install Mac OS X on the volume. This destination is not within the first 8 GB of the hard disk". I have reformated the drive several times and instal
-
FI treatments related to Dispute Management in FSCM
MODERATOR: please read the forum rules about requesting documentation Hi Financial gurus, anybody has documentation of FI treatments related to Dispute Management in FSCM? I'm intrested, in particular, in management of deductions "trade related" tha
-
Query to find previous Activity in STM
I have a database to reflect a State Transition Machine (STM). It contains 3 tables: Activity, Node and Transition. The Node and Transition tables are the configuration of the STM. They define the different possible states and the possible transition
-
Set order of photo stream photos
is there ay way of setting the order of appearence of photos in photo stream or in camera folder.
-
Installing OS 10.5.6 on Macbook
Hi, My question is related to installing the 10.5.6 version of Leopard. I have a white Macbook; it was purchased in August 2007, but it was replaced once in June 2008 due to a hard drive failure. Anyway, I have the new 10.5.6 Leopard install disk. Wh