Post key from array into value upon submit

Hello,
I am new to ColdFusion and new to this forum, so be kind please.  I have a form the gets a select list from an array and I need the key of the array to post into another hidden field upon submission of the form.  I have some javaScript validation before the array, so maybe I could include something there, but I just can't figure it out.  This is what I have so far:
<script language="javascript" type="text/javascript">
<!--
function OnButton1()
    var x=document.forms["Form1"]["name"].value
        if (x==null || x=="")
  alert("Name must be filled out");
  return false;
    var x=document.forms["Form1"]["email"].value
    var atpos=x.indexOf("@");
    var dotpos=x.lastIndexOf(".");
        if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
  alert("Not a valid e-mail address");
  return false;
  var x=document.forms["Form1"]["message"].value
        if (x==null || x=="")
  alert("Message must be filled out");
  return false;
        else
    document.Form1.action = "http://fp1.formmail.com/...."    // First target
    document.Form1.target = "iframe1";
    document.Form1.submit();        // Submit the page
    document.Form1.action = "contact_us_ty.cfm"    // Second target
    document.Form1.target = "contact_us_ty.cfm";
    document.Form1.submit();        // Submit the page
    return true;
-->
</script>
<cfset subject[1] = "Choose Subject or Recipient" />
<cfset subject[2] = "Alexis de Tocqueville Society" />
<cfset subject[3] = "Campaign" />
<cfset subject[4] = "Donations" />
<cfset subject[5] = "Feedback" />
<cfset subject[6] = "Getting Help" />
<cfset subject[7] = "Planned Giving" />
<cfset subject[8] = "UW Community Fund" />
<html>
<head></head>
<body>
        <form name="Form1" action="contact_us_ty" method="post">
            <input type="hidden" name="_pid" value="0" />
            <input type="hidden" name="_fid" value="0" />
            <input type="hidden" name="recipient" value= "NEED THE KEY HERE" />
            <input type="hidden" name="subject" value= "Website Contact Us Email" />
            <table width="*" bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2">
                <tr valign="middle">
                      <td align="right"><strong>Name: </strong></td>
                      <td><input type="text" name="name" size="30" value="" /></td>
                  </tr>
                <tr valign="middle">
                      <td align="right"><strong>Email Address: </strong></td>
                      <td><input type="text" name="email" size="30" value="" /></td>
                  </tr>
                <tr valign="middle">
                      <td align="right"><strong>Subject: </strong></td>
                      <td>
                        <select name="subject" id="subject"><cfloop array="#subject#" index="i"><cfoutput><option>#i#</option></cfoutput></cfloop>       </select>
                     </td>
                  </tr>
                <tr valign="top">
                      <td align="right"><strong>Message: </strong></td>
                      <td><textarea cols="30" rows="8" name="message"></textarea></td>
                  </tr>
                <tr valign="top">
                  <td> </td>
                  <td align="left"><input type="submit" name="button1" value="Submit" onclick="return OnButton1();" /></td>
              </tr>
          </table>
       </form>
<div style="visibility:hidden"><iframe name="iframe1" width="40" height="40"></iframe></div>
  </body>
</html>
Any help is greatly appreciated.
Thanks,
sLe2222

Hi,
1).  I'm assuming that you're naming the select, and passing the array value in the value field.
2).  On the posting page, you should be able to obtain that value.
3).  If you want to then move it into a hidden field, I'd make sure the hidden tag is inside a form tag group, and around that, I'd place <cfoutput> tags.  The value in the hidden tag that you'll want to set to should be inside of #...#.
So page 1: (I'm using input, you should use select)
<form action="two.cfm" method="get">
    <input name="bill" type="text" value="8">
     <input type="submit" value="go">
</form>
Page 2:
<cfoutput>#bill#</cfoutput>
<cfoutput>
<form action="three.cfm" method="get">
    <input name="newbill" type="hidden" value="#bill#">
    <input type="submit" value="go">
</form>
</cfoutput>
Page 3:
<cfoutput>#newbill#</cfoutput>
If you're going to be using this field many times, I'd sugges setting the value equal to a SESSION.variable.  That way you can eliminate all of the hidden tags, which can get really out of hand, and are VERY hard to debug.
something like:  <cfset SESSION.newbill = bill />   Then anytime you need the value, just call the SESSION.newbill.  You would do this on page 2.
Hope this helps,
<cfwild />

Similar Messages

  • Retrieving Key from array

    Hi
    I need a dynamic way of retrieving all the "keys" from a array.
    Found this which is exactly what I need but doesn't work as expected in my case:
    var myObject:Object = {key1:"value1",key2:"value2"}
    for (var s:String in myObject)
    trace("key:",s,"value:",myObject[s]);
    //key: key2 value: value2
    //key: key1 value: value1
    My case:
    var testArray:Array = new Array()
    testArray = DG1.dataProvider.toArray() // create array from dataprovider
    I've tested this array and it performs "correctly" as an array but when I try the above mentioned method it traces as follows:
    key: 0 value: [object Object] (key not being what I need)
    What I need:
    dgArr.push({partNo:event.target.data['partNo'+i],description:event.target.data['descriptio n'+i],cost:event.target.data['cost'+i]});               
    trace (????) //outputs = partNo, description, cost etc...
    Thanks for any help.

    your dataprovider values are also objects.  use:
    function listF(dp:DataProvider):void{
    for(var i:int=0;i<dp.length;i++){
    for(var s:String in dp.getItemAt(i)){
    trace(s,dp.getItemAt(i)[s]);

  • How to bring data from arrays into xy-graph?

    Hello,
    i have some data which is currently stored in two arrays. One array with values and another array with timestamps.
    Now my questions is how can i bring/convert these into the format of XY-graph?
    Thanks for help.

    Hi One,
    - Why do you use a InsertIntoArray when you want to append new plots to an array of plots? Use BuildArray!
    - Why do you initialize your shift register to already contain (atleast) one plot?
    - Why do you use a shift register at all? Why not rely on the autoindexing output tunnel? 3 iterations will yield 3 plots easily…
    - Why don't you clean up your VI before uploading?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Please help! Problems posting chart from Numbers into Pages

    Hello
    I've come across a strange problem, and I'm sure I'm missing some simple trick.
    I have created a chart in Numbers, it looks nice, and crisper than the equivalent Excel diagram. However, when I paste it into Pages, I can't resize it! It seems to preserve the fonts that I specified in Numbers, and so it doesn't become smaller. And I can't see any way of reducing the font size in this chart. And it doesn't resize nicely when I drag the box corner in Numbers.
    The thing is, it's really quite straightforward to create a chart in Excel, and then copy it into Pages, and it resizes and everything with no problems.
    Can anyone give me some pointers as to what I should be doing, please? I'm using the 09 versions.

    tgma
    I suggest you experiment.
    It sounds as if you will be satisfied with a simple graphic version of the chart, however I tested my recommendation and there are bugs in what gets saved, some of the text of the labels is lost and the legend gets rearranged.
    It may be necessary to print the entire Numbers sheet to .pdf and crop that down to the graph.
    The 2nd method of copying over the actual chart to Pages works quite well and the data appears in the linked data in Pages. Just make sure to create the linkage from Numbers to first save the Numbers document before copying and pasting the chart into Pages.
    A black tag will appear on the chart when you select it. The circled arrows in the tag allow you to update the chart from updated (and saved) data in the original Numbers chart. There is also an option in the tag to unlink the chart and make it solely a Pages chart.
    As to text not resizing in Pages, this is generally so in grouped objects. Pages will resize all the graphical parts of a grouped set of objects but keep the fonts at the same point size. This can either be a good or bad thing depending on your viewpoint. Personally my view is that everything should scale as expected.
    In a live chart you can click on each part including the fonts and change their appearance and formatting directly, using the usual methods.
    Peter

  • Post key value

    how to decide posting key for negative valuies and for positive values
    and who will decide this
    i have to assign minus sign to value for posting key say 21.
    how can i do that. is it like this ?
    if itab-BSCHL = '22'.
    concatenate '(-)' amount into itab-amount .
    condense itab-amount no-gaps .
    itab-WRBTR = itab-WRBTR * -1 . but not worki
    endif.
    please reply

    Hi,
    I dont think you can assign the sign to the amount for the posting key...
    Posting keys are divided into Debit and Credit Indicator...
    So system automaically take the sign of the amount from the Posting key you have selected.
    You can try Txn FB01...there you cannot give the amount in negative...it should be positive but after posting u can see the differnece...
    it depends on the posting key ....
    exactly for what purpose you r looking posting key...
    Thnx
    Rahul
    Edited by: Rahul Keshav on Aug 26, 2009 5:36 PM

  • Reading any value from table into a string (Especially date etc..)

    How would I read any value from a table into a string?
    Currently doing the following...
    data ret_val type string.
    select single (wa_map-qes_field) from z_qekko into ret_val
    where
    angnr = _angnr.
    When the source field is a date it bombs though.
    The result goes into a BDCDATA-fval.
    regards
    Dylan.

    Tried...
    1    DATA: lp_data TYPE REF TO DATA.
    2    FIELD-SYMBOLS: <value> TYPE ANY.
    3    CREATE DATA lp_data LIKE (wa_map-qes_field).
    4    ASSIGN lp_data->* TO <value>.
    5    SELECT SINGLE (wa_map-qes_field) FROM zquadrem_qekko INTO <value> WHERE angnr = _angnr.
    Complains that (wa_map-qes_field) is not defined in line 3.
    Think that the bracket thing is only available via SQL.
    What about CREATE DATA lp_data type ref to object. ?
    Would the above declaration work?
    regards

  • I need to add the logic for posting key,

    I need to add the logic for posting key, if posting key = 50 then amount is credit (add negative sign in amount field).
    I creadted this scenario in mapping, We wanted to make sure that the negative sign was placed in the amount field if the posting key was = 50.  So it seems we are good.  We will just need to test.
    How i can test this case?
    Please do needful.
    Thanks in advance.

    Hi,
    You need to use an IfElse node function in your mapping in which the input should be the posting key from the source structure.
    You need to check in the IfElse statement whether the posting key=50, if it is true, then use concat node function to concat the negative sign("-") along with the original value to be passed to the amount field on the target side. Else, if the condition is false(i.e posting key!=50), then simply pass the value to the amount field as it is without adding the negative sign.
    After the mapping is done, go to the test tab and then insert the values in the source fields and then execute from the lower left button showing start transformation.  You need to test with the value of posting key=50 once and with the value not equal to 50 once.In the first case, the output amount field should have the negative sign, which should not be present in the second case.
    You will find your target structure in the righter half of your screen. That's it mate
    Thanks
    Biswajit

  • FB01 uploading problem with posting keys

    Hi Gurus!
    I created this program to upload the FB01 transaction froma  csv file using 'BAPI_ACC_DOCUMENT_CHECK'.
    Everything seems to be working fine except for the fact that even when my csv file has the posting key of 31 for the  vendor and 40 for the gl it picks up 21 and 50 from somewhere and posts that which is wrong. I am not sure why this is happening and where its picking up the posting keys from inspite of the file indicating 31 and 40 respectively.
    My file is as follows:
    02232010;KR;2000;02222010;;CAD;154085;009571;31;925049;20706.84;V005;02222010;C;213728;40;3998;20706.84;1;EA;002;730019;730019 and as you see the 31 and 40 are mentioned in the file but after i run teh program and see the FB03 for the postings it shows me as follows.
    2000     1     000001     21     2000     Trade Accts Payable                    6,935.41     CAD               730019               
    2000     2     000002     50     3998     Trade AR Conversion                    6,935.41-     CAD          730019     730019     
    Could anyone please tell me why is it picking up other posting key istead of mine being provided in the file.
    Thanks

    I followed this:
    ***Vendor account check***
        CLEAR wa_ap.
        wa_ap-itemno_acc         = 1.                           "Item No
        wa_ap-vendor_no         = tw_upload-newko.              "Vendor account no
        wa_ap-item_text         = tw_upload-sgtxt.
        APPEND wa_ap TO ta_ap.
    ***General Ledger account check***
        CLEAR wa_gl.
        wa_gl-itemno_acc         = 2.                           "Item No
        wa_gl-gl_account         = tw_upload-newko_2.           "General ledger account
        wa_gl-item_text          = tw_upload-sgtxt_2.
    *    wa_gl-fis_period         = tw_upload-monat.
        wa_gl-pstng_date         = wa_header-pstng_date.
        wa_gl-costcenter         = tw_upload-kostl.             "Cost center
        wa_gl-profit_ctr         = tw_upload-prctr.             "Profit center
        APPEND wa_gl TO ta_gl.
    ***Currency check***
        CLEAR wa_curr.
        wa_curr-itemno_acc       = 1.
        wa_curr-currency         = tw_upload-waers.
        wa_curr-amt_doccur       = tw_upload-wrbtr .
        APPEND wa_curr TO ta_curr.
        CLEAR wa_curr.
        wa_curr-itemno_acc       = 2.
        wa_curr-currency         = tw_upload-waers.
        wa_curr-amt_doccur       = tw_upload-wrbtr_2 * -1 .
        APPEND wa_curr TO ta_curr.
    **Bapi check for the record to post
        CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
          EXPORTING
            documentheader = wa_header
          TABLES
            accountgl      = ta_gl
            currencyamount = ta_curr
            return         = ta_return
            accountpayable = ta_ap. " If return contains no errors then post documents

  • How to select Posting key flag

    Dear all,
    how to select flag for posting key.
    I'm getting the following Error:
    You cannot enter any data in field BSEG-XREF1
    Message no. ICC_TR168
    Diagnosis
    The system will not allow you to enter any data in the field. The flag for the posting key has not been selected in table TBSL.
    Procedure
    Change the settings in table TBSL for the posting key.
    Pls help me
    Reg
    Kris

    Hello George,
    It seems that the posting key used has field staus as suppressed for the "Reference key1".
    Please change the field status of the posting key from supressed to optional.
    The procedure is as follows:
    Go to Transaction OB41.
    Select the posting key that gives this error message. Double click and enter the entry.
    Select the field status of the posting key.  (It is present in the Edit menu).
    Select the "General Data".
    Make the field "Reference specification 1/2" from "supressed" to "optional".
    Please let me know in case you face any issue.
    Regards,
    Nisha

  • Fetching values from database into a drop down box

    in my JSP page there are 3 drop down boxes for date of birth......
    what i need is i want to get the values from database into that drop down box when i access the JSP page.......
    session is there....'m getting all other values.......
    I will attach the JSP page.....
    Please help me...........
    Thanks in Advance......
    <%@ taglib uri='/WEB-INF/taglib/struts-bean.tld' prefix='bean'%>
    <%@ taglib uri='/WEB-INF/taglib/struts-logic.tld' prefix='logic'%>
    <%@ taglib uri='/WEB-INF/taglib/dyna.tld' prefix='dyna'%>
    <%@ taglib uri='/WEB-INF/taglib/struts-html.tld' prefix='html'%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title><bean:message key="page_title"/></title>
    <link href="<bean:message key="context"/>/CSS/default.css" rel="stylesheet" type="text/css" />
    <script src="<bean:message key="context"/>/js/AC_RunActiveContent.js" type="text/javascript"></script>
    <link href="<bean:message key="context"/>/CSS/screen.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <%!
    Membership mShip = null;
    %>
    <script language="javascript" >
    function checkDate(Form){
    var d;
    d = Form.year.value+"-"+Form.month.value+"-"+Form.day.value;
    alert("Date is:"+d);
    Form.dob.value = d;
    </script>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
         <jsp:include flush="true" page="../templates/header.jsp"/>     </td>
    </tr>
    <tr>
    <td class="menuTD">     
         <jsp:include flush="true" page="../templates/menu.jsp"/>     </td>
    </tr>
    <tr>
    <td class="sub_menuTR"> </td>
    </tr>
    <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td class="column" valign="top" width="170"><jsp:include flush="true" page="../templates/left_panel.jsp"/></td>
    <td valign="top" align="left">
              <dyna:message error="error" warning="warning" message="message"/>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="80%" valign="top" align="left">
                   <%
                   if(session != null){
                   mShip = (Membership)session.getAttribute("member");
                   %>
                        <form action="updateContactDetails.dy" method="post" name="form1">
                        <input type="hidden" name="m" value="<%=request.getParameter("m")%>" />
                             <table width="100%" border="0">
                             <tr>
                                  <td>First Name</td>
                                  <td><input name="first_name" type="text" id= "first_name" value = "<bean:write name = "member" property = "first_name" />" /></td>
                             </tr>
                             <tr>
                                  <td>Last Name </td>
                                  <td><input name="last_name" type="text" id="last_name" value = "<bean:write name = "member" property = "last_name" />" > </td>
                             </tr>
                             <tr>
                                  <td>Address</td>
                                  <td><input name="address1" type="text" id="address1" value = "<bean:write name = "member" property = "address1" />" ></td>
                             </tr>
                             <tr>
                                  <td> </td>
                                  <td><input name="address2" type="text" id="address2" value = "<bean:write name = "member" property = "address2" />" ></td>
                             </tr>
                             <tr>
                                  <td>Suburb/City </td>
                                  <td><input name="city" type="text" id="city" value= "<bean:write name = "member" property = "city" />" ></td>
                             </tr>
                             <tr>
                                  <td>State/Territory</td>
                                  <td><input type="text" name="state" value = "<bean:write name = "member" property = "state" />" ></td>
                             </tr>
                             <tr>
                                  <td>Postcode</td>
                                  <td><input type="text" name="postcode" value = "<bean:write name = "member" property = "postcode" />" ></td>
                             </tr>
                             <tr>
                                  <td>Contact Phone</td>
                                  <td><input type="text" name="home_phone" value = "<bean:write name = "member" property = "home_phone" />" ></td>
                             </tr>
                             <tr>
                                  <td>Mobile</td>
                                  <td><input type="text" name="mobile" value = "<bean:write name = "member" property = "mobile" />" ></td>
                             </tr>
                             <tr>
                                  <td>Date of birth</td>
                                  <td nowrap="nowrap"><select name="day">
    <option>Day</option>
    <option value="01">1</option>
    <option value="02">2</option>
    <option value="03">3</option>
    <option value="04">4</option>
    <option value="05">5</option>
    <option value="06">6</option>
    <option value="07">7</option>
    <option value="08">8</option>
    <option value="09">9</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
    </select>
                                  <select name="month">
                                       <option>Month</option>
                                       <option value="01">January</option>
                                       <option value="02">February</option>
                                       <option value="03">March</option>
                                       <option value="04">April</option>
                                       <option value="05">May</option>
                                       <option value="06">June</option>
                                       <option value="07">July</option>
                                       <option value="08">August</option>
                                       <option value="09">September</option>
                                       <option value="10">October</option>
                                       <option value="11">November</option>
                                       <option value="12">Decembber</option>
                                  </select>
                                       <select name="year" onChange = "checkDate(this.form);" >
                                       <option>Year</option>
                                       <option value="1957">1957</option>
                                       <option value="1956">1956</option>
                                       <option value="1955">1955</option>
                                       <option value="1954">1954</option>
                                       <option value="1955">1955</option>
                                       <option value="1956">1956</option>
                                       <option value="1957">1957</option>
                                       <option value="1958">1958</option>
                                       <option value="1959">1959</option>
                                       <option value="1960">1960</option>
                                       <option value="1961">1961</option>
                                       <option value="1962">1962</option>
                                       <option value="1963">1963</option>
                                       <option value="1964">1964</option>
                                       <option value="1965">1965</option>
                                       <option value="1966">1966</option>
                                       <option value="1967">1967</option>
                                       <option value="1968">1968</option>
                                       <option value="1969">1969</option>
                                       <option value="1970">1970</option>
                                       <option value="1971">1971</option>
                                       <option value="1972">1972</option>
                                       <option value="1973">1973</option>
                                       <option value="1974">1974</option>
                                       <option value="1975">1975</option>
                                       <option value="1976">1976</option>
                                       <option value="1977">1977</option>
                                       <option value="1978">1978</option>
                                       <option value="1979">1979</option>
                                       <option value="1980">1980</option>
                                       <option value="1981">1981</option>
                                       <option value="1982">1982</option>
                                       <option value="1983">1983</option>
                                       <option value="1984">1984</option>
                                       <option value="1985">1985</option>
                                       <option value="1986">1986</option>
                                       <option value="1987">1987</option>
                                       <option value="1988">1988</option>
                                       <option value="1989">1989</option>
                                       <option value="1990">1990</option>
                                       <option value="1991">1991</option>
                                       <option value="1992">1992</option>
                                       <option value="1993">1993</option>
                                       <option value="1994">1994</option>
                                       <option value="1995">1995</option>
                                       <option value="1996">1996</option>
                                       <option value="1997">1997</option>
                                       <option value="1998">1998</option>
                                       <option value="1999">1999</option>
                                       <option value="2000">2000</option>
                                       <option value="2001">2001</option>
                                       <option value="2002">2002</option>
                                       <option value="2003">2003</option>
                                       <option value="2004">2004</option>
                                       <option value="2005">2005</option>
                                       <option value="2006">2006</option>
                                       <option value="2007">2007</option>
                             </select ></td></tr>
                             <tr>
                                  <td><input type="hidden" name = "dob" /> </td>
                                  <td nowrap="nowrap"><input type="submit" value="Submit" /></td>
                             </tr>
                             </table>
                        </form>
                   </td>
    <td width="40"></td>
    <td width="200" valign="top">
                   <div id="headlines">
    <jsp:include flush="true" page="../templates/profile.jsp"/>
    </div>
                   </td>
    </tr>
    </table>
              </td>
    <td> </td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td><jsp:include flush="true" page="../templates/footer.jsp"/></td>
    </tr>
    </table>
    </body>
    </html>

    i think normally u will get data from databsae as objects.they are like java beans having getter and setter methods.so you create a collection of those objects like collect all the objects coming from database into an arraylist or....
    suppose you want to populate the dropdown box with say "username" from database object s, your code will look like that
    <html:select property="name">
    <html:options collection="databaseList" property="username" />
    </html:select>
    "databaseList" is collection(say.. ArrayList) of objects you are getting from database.this dropdown will contain all the "usernames" you are getting from database.

  • Smartview webf run time prompts upon submit are not picking up from the POV

    Hi ,
    I am in Planning 11.1.2.1 and using Smartview 11.1.2.1.103. After connecting to Planning Webform from Smartview, i am saving a composite form which should launch a Business Rule with run time prompts attached to the webform upon submit. The business rules are running with default run time prompts and it is not picking up the members from the POV ... is there a way to make it pick up the members from POV into the run time prompts upon saving it ? so far the workaround is to initiate the business rule from the planning tab in smartview .. any thoughts on this ? cheers

    I found a known issue for smart view in 11.1.2.1 read me doc
    11075506
    When you open a data form in Smart View, if a business rule is directly attached to a composite data form that is set to Use Members on Data Form and Hide Prompt, the runtime prompt values are not picked up. Instead, the Runtime Prompt dialog box is displayed, and the user is prompted to enter a value.
    Good Luck

  • Putting the values of an array into a combobox

    Hey I'm looking for some advice on an error I'm getting
    First heres the program:
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    import java.awt.event.*;
    public class Quizgame implements EventListener {
         JPanel mainPanel;
         JFrame theFrame;
         public static void main(String[] args) { Quizgame b = new Quizgame(); b.buildGUI(); }
         public void buildGUI() {
              Quizbook Q = new Quizbook("C:\\Users\\Boab\\Desktop\\JavaRe-sit\\FileInput.txt");
              String question = Q.getContent(0);
              String Ans1= Q.getContent(1);
              String Ans2= Q.getContent(2);
              String Ans3= Q.getContent(3);
              String Ans4= Q.getContent(4);
              theFrame=new JFrame("QuizGame");
              BorderLayout layout = new BorderLayout();
              JPanel background = new JPanel(layout);
              background.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              Box buttonBox = new Box (BoxLayout.Y_AXIS);
              JButton start = new JButton("Submit");
              start.addActionListener(new MyStartListener());
              buttonBox.add(start);
              JComboBox Answer = new JComboBox(Q);
              start.addActionListener(new MyStartListener());
              buttonBox.add(Answer);
              Box QuestionBox = new Box(BoxLayout.X_AXIS);
              Box nameBox = new Box(BoxLayout.Y_AXIS);
              nameBox.add (new Label(Ans1));
              nameBox.add (new Label(Ans2));
              nameBox.add (new Label(Ans3));
              nameBox.add (new Label(Ans4));
              QuestionBox.add(new Label(question));
              background.add(BorderLayout.EAST, buttonBox);
              background.add(BorderLayout.WEST, nameBox);
              background.add(BorderLayout.NORTH, QuestionBox);
              theFrame.getContentPane().add(background);
              GridLayout grid = new GridLayout(16,16);
              grid.setVgap(1); grid.setHgap(2);
              mainPanel = new JPanel(grid);
              background.add(BorderLayout.CENTER, mainPanel);
              theFrame.setBounds(150,150,1,1); theFrame.pack(); theFrame.setVisible(true);
         public class MyStartListener implements ActionListener {
         public void actionPerformed(ActionEvent a) {
                   //where you put whats to happen
         public class comboListener implements ActionListener {
         public void actionPerformed(ActionEvent a) {
                   //where you put whats to happen
         There is another file which creates an array of strings with the instance Q in this class ^
    I'm trying to fill the combobox with the values of the array but I can't get it too work. With the code as it is now I get:
    C:\Users\Boab\Desktop\Seperate Java files\NewQuiz\Quizgame\Quizgame.java:41: cannot find symbol
    symbol : constructor JComboBox(Quizbook)
    location: class javax.swing.JComboBox
              JComboBox Answer = new JComboBox(Q);
    ^
    1 error
    I don't really understand why it doesn't work, When I look up the error online its about the class but it works fine without the Combobox line. Any ideas why it won't put the array into the combobox?
    Also my next step is to put only certain values into the combobox i.e values 2-4 in the array, Is there any smart piece of code to do this or do I need to put a loop in with an addcontent and hardcode it?
    Thanks for any help

    Yeah sorry, Quizbook is a class with a method to read out the array the method is:
         public String getContent(int element)
              //access arraylist and return
              return (String)Quizbook.get(element);
         so I tried what you said and put :
    JComboBox Answer = new JComboBox(Q.getContent(5));
    Because the Answer is at that location in the array but it gave me the same error message:
    C:\Users\Boab\Desktop\Seperate Java files\NewQuiz\Quizgame\Quizgame.java:41: cannot find symbol
    symbol : constructor JComboBox(java.lang.String)
    location: class javax.swing.JComboBox
              JComboBox Answer = new JComboBox(Q.getContent(3));
    ^
    1 error
    Process completed.
    So I would of thought that meant use the getContent method from Q object with element bieng 3?

  • Passing field value from appoinment into task

    Hi,
    I need to pass the field values from appointment into the task. I was able to pass values from one record type to another but in this case as both appointment and task belong to the same record type namely activity and they are having the same foreign key namely ActivityId.
    So any one please tell me , is it possible to pass values from appointment in to the task or not ?
    If so how?
    Thanks,
    Kirubahar.
    Edited by: Kiruba on Mar 4, 2011 6:45 AM

    Write a workflow and select the field you want to copy the value into in the Field Name and the value you want to copy in value field, you don't need to use joinfieldValue at all.
    cheers
    Alex

  • Loading key and/or description from BW into BPC

    Dear all,
    We have the requirement to load master data from BW into BPC 10 NW (SP4) and are facing some difficulties.
    Depending on the property, we want to do the following:
    - Load the attribute key into BPC property
    - Load the attribute description into BPC property
    - Load both concatenated using an underscore into BPC property
    The loading process as such works and the concatenation would aswell, but so far I'm only able to load the keys into BPC. In the BW table I can see that the attribute has both a key and a description but I don't know how to select the description in BPC (either through transformation file, set selection, ...). Is there a standard functionality to select between a key and a description in BPC 10 or do I have to ask the BW-team to make an additional attribute with the description as a key?
    Same goes for loading the member ID's and member descriptions for a specific dimension. There we want to fill the member ID in BPC with the BW description and use another BW description to fill the member description in BPC.
    Any advice/input would be greatly appreciated!
    Thanks in advance,
    Matthias

    Hi Matthias,
    I have the same problem and I don't know how to solve it.
    While loading master data into BPC InfoObjects (or as called in BPC jargon "Dimensions") I found out, that it is possible to load the Attribute ID's relatetd to the InfoObject, while it is not possible to load the corresponding descriptions.
    Actually I cant help you with my post. But atrouble shared is a trouble halfed
    I would be pleased if somebody could offer any solution to this problem
    Kind Regards,
    George

  • Sending arrays from Excel into Labview

    I want to send an array from Excel VBA into a LabView VI.
    The Excel example shows how to send individual numbers and return an array into Excel but not send an array.
    Everything tried sends blank arrays into LabView, which can then be modified in LabView and returned to Excel.
    A VBA code snippit that does not work is:
    Sub LoadData()
    ' LoadData Macro
    ' Keyboard Shortcut: Ctrl+l
    ' This is an example to demonstrate LabVIEW's Active-X server capabilities.
    ' Executing this macro loads a LabVIEW supplied example VI "Frequency Response.vi",
    ' runs it and plots the result on an Excel Chart.
    Dim lvapp As LabVIEW.Application
    Dim vi As LabVIEW.VirtualInstrument
    Dim paramNames(0)
    Dim paramVals As Variant
    Set lvapp = CreateObject("LabVIEW.Application")
    viPath = lvapp.ApplicationDirectory + "\examples\apps\freqresp.llb\DAK Frequency Response.vi"
    Set vi = lvapp.GetVIReference(viPath)   'Load the vi into memory
    vi.FPWinOpen = True                     'Open front panel
    paramNames(0) = "Foo"
    paramVals = Sheet1.Range("j1:j1000").Value
    Call vi.Call(paramNames, paramVals)
    This code generates an error - expecting 1D array or variants.
    However, if I supply the correct array, then LabView thinks it is empty
    'foo' is a cluster
    'Array' is a double array
    Neither work to receive the data

    Thanks for the reply but that approach will be difficult.  The problem to solve is relatively simple IF LabView could read arrays (it writes arrays easily).  Here is the problem:
    I want to convolute two large arrays.  I have written VBA programs to do this but they take too long - over 30 sec whereas the LabView version take <1 sec IF I could get the data into LabView.
    The convolute is part of an optimization program that goes though many loops so that it takes hours to run efficiently AND if I manually change cells in the spreadsheet, then it takes 30sec to come back as VBA does not respect clean cells (for some reason).
    I was trying to write a function in VBA to do this calculation via LabView rather than VBA.  One way to  do this is to write a text file in VBA and read in LabView, then pass the results back or maybe the clipboard as a buffer.  That is faster but clumsy.  You could also have LabView look for dirty cells and then do the calculation as the server rather than the client.  Again, time consuming and cumbersome.  I have written pure LabView code to do the curve fitting but prefer to use Excel as that is easier to incorporate and work with the data.   You can do convolute using FFTs but Excel does not do that correctly - they CANNOT make their FFTs into a function (VBA functions cannot modify cells in the spreadsheet but only return variables.  FFT modifies cells so cannot be called from a function, only a macro, which then needs to be updated manually).  Again, I can kluge VBA (real kluge this time) to make FFTs work as a function BUT prefer the LabView solution, if possible, as I am not sure the FFT will actually save time.
    I am not sure if the problem is LabView's fault or Excel's (2013) fault that the variables are not set-up properly.  LabView claims to be able to do this.  Again, you can pass single variables into LabView and read back arrays but try as I might, I cannot get arrays into LabView.
    Any help in sending arrays (maybe Labview expects a variant variable and needs to convert it somehow) would be appreciated.  Variants are suppose to be able to be converted automatically but maybe there is a bug in LabView (2010) that does not handle input variant arrays correctly (I have tried making them clusters, double arrays, ect).  LabView thinks that all the arrays sent by VBA are empty. If LabView modifies the same array, VBA sees that modification so that the addresses appear to be sent correctly i.e. the array "handle" is being sent to LabView or else it could not fill the array to send back to VBA.
    If ever this is solved, I will put on-line the solution for others as again marrying both programs will have advantages.  Others may find this interesting is marry LabView with Excel so that LabView does some of the heavy calculations that Excel has kluged. 

Maybe you are looking for

  • Hyperlinks work in Firefox not in IE

    I am having trouble to get some of my hyperlinks to work in IE. They work fine in Firefox but not at all in IE. I am using relative links as the website will be run off of a CD that will be sent to many people. My current code looks like this for the

  • Errors coming in import utility

    i am using a command to import dmp file to Oracle 9i Database imp point/[email protected] file=expu.dmp full=yes but in return i am getting this error, not a valid export file, header failed verification import terminated unsuccessfully... Will anyon

  • Error LiveKernelEvent

    Hello. I have a Lenovo G460, with a NVIDIA GeForce 310M, and the last week this error appeared: "Error LiveKernelEvent". Since that day and randomly, the screen changes colors with blue bands that appears and dissapears. I don't know what to do with

  • Heavy Logic X bug

    Did anyone notice that when you add an audio file to a track and use the undo function after, Logic starts reloading ALL instruments including samples, this can be quite annoying when you work with big orchestral templates.

  • ALE issue:No partner profiles (message control) maintained

    Hi,gurus: My ALE scenario is tranferring PO from client 800 to 900 client. Now the logical system,partner profile,port,rfc,distribution model are created both the sender and receiver side. In ME21N->MESSAGE, the output type is NEU,and medium is A,par