CFquery to javaScript Array to Listbox

Help!
Here's what I've got so far:
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<cfquery datasource="ERMRiskMgmt" name="DelegateList">
SELECT CoordFirst + ' ' + CoordLast AS 'AvailDelegate',
CoordID
FROM dbo.ERMCoordinators
ORDER BY CoordLast
</cfquery>
<script language="javascript" >
function addOption(selectbox,text,value )
var optn = document.createElement("option");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
function addOption_list(selectbox)
var nator = new Array(<cfoutput
query="DelegateList">"#AvailDelegate#",</cfoutput>"");
for (var i=0; i < nator.length;++i)
addOption(document.drop_list.DelegateSelect, nator
, <cfoutput
query="DelegateList">#CoordID#</cfoutput>);
</script>
<title>Untitled Document</title>
</head>
<body onload="addOption_list()";>
<form name="drop_list" action="" method="post" >
<select name="DelegateSelect">
<option value="" ></option>
</select>
</form>
</body>
</html>
I realize those 2 queries arent 'associated' yet - still
workin on that - Help! Ty!

End Result, Display a Listbox with the Coordinator Fullnames,
having the value
of that Coordinators ID.
I'm using the Array Because the 'form' is inside a CFOUTPUT
for a list of
reports, not directly related to this CFOUTPUT of coordinator
Names. Its there
to allow for the delegation of reports to members of the
'Coordinator Table' .
I hope that claifies...?

Similar Messages

  • Cfquery to javascript array to .js file

    Hi guys,
    I've got a small problem out there:
    have cities table in the database therefore pulling out everything using cfquery .
    <cfquery name="get_city" datasource="IGES">
    SELECT *
    FROM cities
    ORDER BY City ASC
    </cfquery>
    Now all these city names from database needs to be passed to .js file in some sort of array
    <script type="text/javascript" src="../jscripts/add_school.js"></script>
    ^^^^^^^^that's the file all the javascript is in
    Is there any way to pass an array made from cfquery to javascript file where it can be used to populate listbox.
    cheers,
    Simon

    Hi Ian,
    Thanks a lot, that toScript() stuff did the job properly.
    cheers,
    Simon
    "learning every day"

  • Adobe Acrobat 9: Javascript array populated combo box - Selected answer will not save

    I have a combo box on one of my forms that is populated using a Javascript array.  The combo box is populating just fine, but when an item is selected from that combo box, the selected item does not save when the user saves the document.  Any suggestions as to what the problem is and how it can be corrected?  I am a loss as to where to even begin looking.  Any help is greatly appreciated.
    Thank you.
    Lisa

    You might also want to check the Scripting forum
    http://forums.adobe.com/community/acrobat/acrobat_scripting

  • How to pass java arraylist into javascript arrays

    Hi, i have declare an arraylist
    ArrayList list1 = new ArrayList();Inside the arraylist, there are elements. Now, i wan to pass the elements in the java arraylist into javascript arrays but i encounter javascript errors.
    This is how i code.
    var arr1 = new Array();
    <%
    for ( int x =0; x<list1.size(); x++)
    %>
         arr1[<%=x%>] = <%=(String)list1.get(x)%>;
    <%
    %>how do i solve this problem?
    Thanks for the guidance in advance

    JTech wrote:
    Hi,
    Use Quotes around string value ( arr1[indexposition] = "stringvalue";), when assign to javascript array as below.
    arr1[<%=x%>] = "<%=(String)list1.get(x)%>"; Regards,
    Ram.Hi Ram,
    How about using arr1 = <%=list.toArray()%> ??? Is this possible? I tried it but was not working on my IDE. Do you have any solutions for this??
    Regards,
    Thiagu

  • 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)

  • Getting pcs:foreach to iterate a Javascript array

    Dear Experts,
    I've got a selection list in a content item, and I can happily use <pcs:foreach> to iterate over it.
    So now, I would like to add an additional item to that which the user has selected, or get rid of some of the items.
    I have been able to get the values that I want intop a javascript array, but <pcs:foreach> to iterate. I have tried a delimited string with both a spaces and commas, no luck.
    Any ideas on programatically editing a selection list, or getting <pcs:foreach> to deal with an array?
    Thanks!
    Rob
    PS Here's the code !
    <script>
    var NewsCategoriesToShow = myArray.split(',');
    </script>
    This fails: <pcs:foreach var="cat" expr="NewsCategoriesToShow">
    This also fails: <pcs:foreach var="cat" expr="myArray">
    Only this works: <pcs:foreach var="cat" expr="mySelectionList">
    ...

    have you tried using straight javascript or jquery to edit the selection list after it is built? like with some javascript at the bottom of the page? i'll see if i can dig up any old code to see if i find that i've done this before.

  • Assigning javascript array with jsp array

    hi,
    I have a jsp page where I have a array in jsp. I want to assign the values to an javascipt array. how can I do that?
    the reason why I want to do this is for a perticular problem I am facing in javascript. that is....
    I have a text box in my jsp page, I want the value entered in that box to be checked (whether it exists ) against a hidden string which has some value. I want that hidden string not to be shown to the user even on seeing the html source. that is why I want these values to be stored and checked against a array object of javascript.
    any suggestion is appreciated
    Thanks
    Ashutosh

    Hai asutoshdash
    if you dont mind of viewing code u can use this else dont use, its not matters weatehr user will see you code or not if the user is professiona then its a big issue normal users not think of is for this dont send valuable infos like password etc to client u may send usernames
    ok to create a java array to javascript array do this (i took example of db to array ) write this inside <script> <%codes here%> </script>
    var aUsername =new array();
    <%
    int i=0;
    while (rs.next())
    %>
    aUsername[<%= ++i%>] = "<%= rs.getString("User_Name")%>";
    <%
    %>thats it use this array where ever you want in your client side(javascript ) usage
    hope this will help you
    archi

  • Load CF varibales into javascript array without outputing to source code

    I have a javascript array for dynamic dropdowns - Automobile, makes,models, etc.
    The javascript arrays are populated by by cf queries
    Everythign works and functions fine - but it also loads the entire array (hundreds of lines of code) into the browser source code.
    I would like to have the javascript arrays hidden from the browser source code by calling it:
    <script language="JavaScript" type='text/javascript' src='../js/super.js'></script>
    But when I code like this, the js file 'super.js' does not run the cf variables.
    The only way I can get it to function right now is to save a cf file called 'super.cfm' and have it run the cf query, then list the javascript code under the query on this cf template.
    THis works - but again, it causes the entire javascript code to be visible to the browser source code...
    any ideas? - I am on cf 7
    thanks in advance

    thanks for your idea
    I ended up rethinking the whole process and realized that I only update my vehicle make/model list about once a week
    So what I ended up doing was creating the the dynamic javascript arrays through cf - and rendered them in a browser, then took the browser source code (the fully rendered javascript arrays) and saved them as a static js file
    My website uses this js file on every page, so I no longer need to call queries on every single page to populate the javascript arrays - they are already built and I am guessing cached by the browser  (browsers cache js files right?)
    SO this runs more efficiently.
    The only draw back is that when I add a new vehicle to the list in my database, I will need to manually do the same process of rendering the new js code, then cutting and pasting it into my static js file that gets called by all pages.
    So it loses the realtime updates - but this only happened once a week anyway - and it only takes me five minutes to create the new file.
    We'll see if I get sick of manually creating a new js file each week - probably, but this seems better than making the server re-render the code on each page.
    Does this make sense? - would this be less overhead on the server than implimenting your concept?
    thanks.

  • Java Vector to Javascript Array

    Hi all, im facing a potential problem and would be very grateful for any help on the following
    I want a Vector (rather several Vectors) comprising of serializable plain old java objects. I will have a JSP or plain HTML (probably JSP) page containing, amongst other things, a javascript array or set of arrays i want to have populated with the contents of the vectors . . .
    Is this possible? not after code really just a feasible way of implementing this . . .it mi9ght turn out that it cann all be done via JSP / Java.
    P.S. Asan after thought, when writing this,anyone know where i can find information regarding java accessing manipulating HTML DOM please
    Thanks in advance for the help people.

    Cool Thanks for your replies. At least i know that it cant be done i wont look for anything on HTML DOM .....
    I dont believe i didnt see that method of implementation for the vector problem it seems so straight forward .. thats what I get for being a newb at both JSP and Javascript :)
    Thanks again gus much appreciated

  • Cfquery within javascript

    hi,
    I am trying to do the following:
    I wrote a cfquery within javascript function as below:
    <script language="javascript1.2" type="text/javascript">
    <cfquery name="query1 datasource="abc">
    </cfquery>
    <cfif query1.recordcount neq "0">
        <cfoutput query = "query1">
           <cfquery name="query2 datasource="abc">
      select * from table1 where name=#query1.name#
           </cfquery>
        </cfoutput>
         alert(<cfoutput>#query2.RecordCount#</cfoutput>);
    </cfif>
    </script>
    The alert value is 1 but the debugging section shows 0, and 0 is the correct value. is there something wrong that I am doing.
    If so can you please point out...

    The problem comes from how CF and JS work: Coldfusion is a "Server Side" language while Javascript is "Client Side". This means the server runs through all the CF code in your page and sends the finished product on to the user's browser which THEN starts handling the Javascript.
    I'm not sure of your intended outcome ... do you want a series of "alerts" as soon as the page loads? If you are using the alert for debugging (just to see what is being returned, you can replace it with <p> tags and you will see the output on screen. Try this:
    <cfif query1.recordcount neq "0">
         <cfoutput query = "query1">
              <cfquery name="query2 datasource="abc">
              select * from table1 where name=#query1.name#
              </cfquery>
              <p>#query2.RecordCount#</p>
         </cfoutput>
    </cfif>
    2 more notes:
    you don't the inner "cfoutput" around you record output if you are going to use cfoutpu to loop over your query.
    the output line needs to be INSIDE the loop or you'll only output the last iteration.

  • Jsp variables to javascript array, for loop dont work.

    This works fine. con.getmake passes a different variable each time to the javascript array using a manual index.
    <script>
    make[0] = "<%= con.getmake() %>" ;
    document.write(make[0]);
    make[1] = "<%= con.getmake() %>" ;
    document.write(make[1]);
    make[2] = "<%= con.getmake() %>" ;
    document.write(make[2]);
    make[3] = "<%= con.getmake() %>" ;
    document.write(make[3]);
    </script>
    If I try and do the same with a for loop, It seems as though all the elements hold the same first variable retrieved from con.getmake, I am not getting the next variable from my java class.
    <script>
    for (var i= 0; i <= 2; i++)
    make[i] = "<%= con.getmake() %>" ;
    document.write(make);
    </script>

    Hi,
    Java is parsed once on the server which creates a HTML page, then it is passed to the client's browser where the javascript is executed. So con.getmake() is only executed once in java. You've got to execute your loop in java not javascript :
    <script>
    <%
    for (int i= 0; i <= 2; i++)
    %>
    document.write("<%= con.getmake() %>");
    <%
    %>
    </script>

  • Javascript array for iGrid & iCharts

    Is there a way to push javascript array data to IGrid and iChart display templates?

    The runtime java applets only 'pull' data by executing the underlying query template, so there is no way for you to directly 'push' data from a JavaScript array into them.
    An indirect way to accomplish this would be to pass the contents of your array as a comma separated list into a query parameter (Param.x) as an IN clause in a SQL Query template or through an Xacute Query to a BLS transaction, where you could process the list as desired and return the dataset to the applet.  Not a very direct approach, but a possibility.
    Regards,
    Jeremy

  • How to fill a javascript array by a jsp array when the jsp is run

    Hi all,
    The problem i am facing is -- i want to use an javascript array in a function. The records are being fetched by jsp.
    How to fill the vaules in a javascript array, which are retrieved by a jsp array
    Please suggest
    Thanking You

    You can use the code below:
    <input type="button" value="Click Me" onclick="javascript:disp('<%= getString(str) %>')">
    <%!
    public String getString(String str[]){
    String arrElements="";
    for(int i=0;i<str.length;i++) {
    arrElements+=str[i]+",";
    return arrElements.substring(0,arrElements.length()-1);
    %>
    function disp(str) {
    arr = str.split(",");
    alert ("There are "+arr.length+" elements in the array");
    Hope this helps.

  • Storing data from resultset to javascript array

    Hi all,
    Can anyone let me know how to store data from servlet's result set to javascript array ?
    Firstly i have downloaded all the data at client side in the resultset while the servlet form
    is first loaded...then i want to use javascript array to check that whether the code entered by
    the user on runtime exists in resultset or not.
    If the code doesnot exist the user will be prompted to enter another code by alert.
    and if the specified code exists then the name of the respective client will be displayed in
    text box on the servlet form.
    For this reason i want to use javascript for code validation.
    Thanks for any help in advance.
    sunny.v

    Just let JSP print it as JS array.

  • Convert javascript array to java array

    Is there any way possible to convert javascript array to java array?

    if you will try to experiment a javascript array
    putting it to a hidden element, it will be converted
    to a string (comma delimited). You can get the value
    of that element as a string and use StringTokenizer
    class to put the values into a java arrayThanks, got it.

Maybe you are looking for

  • Payment advice note to vendors thru e mail

    Guys, After executing F110, system generates the payment advices.I updated the master reocrd of vendor with a test email id , system is sending payment advices to this mail id,as its our internal server mail id.But when I update vendor record with so

  • Polling for XML data

    My task is to design a module which will be pollong an url for some xml data. The data will be updated from the source at around 19.30 (+/- 1 hour) every day. I'm on wls 6.1 with portal in a J2EE application. Anybody know a pattern for this? Any sugg

  • Storing null reference as 0

    I'm working with a schema that I cannot change and it doesn't allow nulls in id columns, they must be stored as 0. So there's an issue when I have a class A with a reference to class B, a.b. The table persisting A has a column bId, which would store

  • Can't connect to my Synology NAS server

    Hi I just bought a Synology D212j. I am having hard time to connect to it trough afp or smb. My issue is that when I go to connect to server (Command K) and browse the network, I can see the NAS. When I go to "connect as" it times out and says "conne

  • Extracting XSD from WSDL

    Hi Everyone, I am looking at a very simple scenario: Flat file to Web Service Through SAP XI. I have created a web service in SAP ECC system. With the help of WSDL document of the web service i created a Message Interface(External Definitions). On th