How to apply a simple javascript into JSF

Hi everyone. This is my first time using JSF and i am abit confuse in applying some simple javascript into my JSF. Actually, i just want to add a simple function that is to disable user from input some certain textfield (h:inputText) based on the selection in the combo box (h:selectOneMenu).
The javascipt that i would like to apply in the JSF coding is shown as below:-
<HTML>
<TITLE>Example of onChange Event Handler</TITLE>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function textField()
if(document.myform.mcDonald.value=="disable")
document.myform.data.disabled=true;
if(document.myform.mcDonald.value=="enable")
document.myform.data.disabled=false;
</SCRIPT>
</HEAD>
<BODY>
<H3>Example of onChange Event Handler</H3>
<form name="myform">
<SELECT NAME="mcDonald" onChange="textField()">
<OPTION VALUE="enable">Enable
<OPTION VALUE="disable">Disable
</SELECT>
<input type="text" name="data" value="10" size=10 disabled="true" >
</form>
</BODY>
</HTML>

You need to use the id's of the components in the hierarchy. This is actual working code:
// Javascript
          function actionedStatus_onchange(formObj, fieldValue) {
               formObj.elements['foureye:tabExceptions:unresolvedOnly'].disabled = (fieldValue != 'all');
               formObj.elements['foureye:tabExceptions:unresolvedOnly'].checked = (fieldValue == 'all');
// JSF
               <x:selectOneMenu id="actionedStatus" styleClass="detailBondField" value="#{exceptionsBean.actionedStatus}"
                         onchange="actionedStatus_onchange(this.form, this.value)">
                    <f:selectItems value="#{lookupBean.actionedStatusList}"/>
               </x:selectOneMenu>
In this case, the root component form is 'foureye' (a subview), followed by 'tabExceptions' (a form), followed by a checkbox 'unresolvedOnly' that I want to manipulate. Here I am disabling the checkbox and setting the value dependent on the value of the selectOneMenu

Similar Messages

  • How to use ocx with javascript in jsf page

    Hello,
    Please i create a jsf page which purpose is to scan.
    I used in a source of my jsf page an OCX with object tag like
    <OBJECT ID="Ranger"
    CLASSID="CLSID:1C5C9095-05A8-11D4-9AF9-00104B23E2B1">
    </OBJECT>
    i wrote my functions which use this ocx in javascript. Function that i call with clientlistener rear adf button
    but it doesn't work
    Could you please help me please VERY IMPORTANT

    This my html code:
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportNewState(newState,previousState)>  
    // Transport new state, fired every time the State changes on the control
    // input params , are the new state and the previous state
    //alert(newState);
    var RangerTransportStates = {TransportUnknownState: -1, TransportShutDown: 0, TransportStartingUp: 1,
                                  TransportChangeOptions: 2, TransportEnablingOptions: 3, TransportReadyToFeed: 4,
                                  TransportFeeding: 5, TransportExceptionInProgress:6, TransportShuttingDown: 7};
    if(newState == RangerTransportStates.TransportShutDown)
          document.getElementById('StartRanger').disabled = false;
          document.getElementById('EnableRanger').disabled = true;
          document.getElementById('StopFeeding').disabled = true;
          document.getElementById('StartFeeding').disabled = true;
          document.getElementById('ChangeOptions').disabled = true;
          document.getElementById('Shutdown').disabled = true;     
          document.getElementById('UserInstructions').innerHTML = "Press 'Startup Ranger' to initialize the Ranger control"
    if(newState == RangerTransportStates.TransportChangeOptions)
          document.getElementById('StartRanger').disabled = true;
          document.getElementById('StartFeeding').disabled = true;
          document.getElementById('EnableRanger').disabled = false;
          document.getElementById('Shutdown').disabled = false;
          document.getElementById('UserInstructions').innerHTML = "<b>Ranger Started</b> <br> Press 'Enable Ranger' to enable the current Ranger Options and prepare to start feeding"
    if(newState == RangerTransportStates.TransportReadyToFeed)
          document.getElementById('EnableRanger').disabled = true;
          document.getElementById('StopFeeding').disabled = true;
          document.getElementById('StartFeeding').disabled = false;
          document.getElementById('ChangeOptions').disabled = false;
          document.getElementById('Shutdown').disabled = false;
          document.getElementById('UserInstructions').innerHTML = "<b>Ready to feed </b><br> Press 'Start Feeding' to start Ranger Feeding checks from main hopper"
    if(newState == RangerTransportStates.TransportFeeding)
          document.getElementById('StartFeeding').disabled = true;
          document.getElementById('ChangeOptions').disabled = true;
          document.getElementById('Shutdown').disabled = true;
          document.getElementById('StopFeeding').disabled = false;     
          document.getElementById('UserInstructions').innerHTML = "<b>Feeding... </b><br> Press 'Stop Feeding' to stop Ranger from Feeding checks"
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportChangeOptionsState(previousState)>  
    //Fired when Ranger reaches the change option state, input params are previous state
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportReadyToFeedState(previousState)>  
    //Fired when ranger is ready to feed the next item
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportFeedingStopped(reason,itemsFed,itemsrequested)>  
    //Fired when feeding has stopped
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportItemInPocket(itemID)>  
    //Fired when the item has been fed into the pocket
    var RangerSides = {TransportFront: 0, TransportRear: 1};
    var RangerImageColorTypes = {ImageColorTypeBitonal:0, ImageColorTypeGrayscale: 1, ImageColorTypeColor: 2};
    // Note: SaveImageToFile() below is used to save gray scale images.  Please verify that 'NeedFrontImage2' and
    //       'NeedRearImage2' are set to 'true' in the GenericOptions.ini file.  If bitonal images are to be saved,
    //       please set 'NeedFrontImage1'/'NeedRearImage1' to 'true' before calling SaveImageToFile() for bitonal images.
    document.getElementById('MICR').innerHTML = 'MICR: ' + Ranger.GetMicrText(1);
    temp = Ranger.SaveImageToFile(RangerSides.TransportFront, RangerImageColorTypes.ImageColorTypeGrayscale, "C:\\test\\Testfront.jpg");
    temp = Ranger.SaveImageToFile(RangerSides.TransportRear, RangerImageColorTypes.ImageColorTypeGrayscale,"C:\\test\\Testback.jpg");
    //Here you could check to see if the images were saved, putting alternate
    //text in place of the image if they werent saved.
    document.getElementById('PIC').innerHTML = '<img height=200 width=400 src=' + '"Testfront.jpg">' + '<br>' + '<img height=200 width=400 src=' + '"Testback.jpg">';
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportNewItem()>  
    // Fired when a new item has entered the track
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportShutDownState(currentState,previousState)>  
    //Fired when the Ranger control has been shutdown
    getstatus();
    </SCRIPT> 
    <SCRIPT LANGUAGE=javascript FOR=Ranger EVENT=TransportSetItemOutput(itemID)>  
    //fired when the item is ready to have params set(pocketing decisions)
    getstatus();
    </SCRIPT> 
    <!-- End of Events ------------- -->
    <SCRIPT LANGUAGE="javascript">
    function getstatus()
         document.getElementById('Status').innerHTML = 'Status: ' + Ranger.GetTransportStateString();
    </SCRIPT>
    </head>
    <body>
    <OBJECT ID="Ranger"
    CLASSID="CLSID:1C5C9095-05A8-11D4-9AF9-00104B23E2B1">
    </OBJECT>
    <div id="container">
         <div id="banner" >
         </div>
         <div id="left">
              <h2>Ranger Control Buttons</h2>
              <br><div id="Status">Status:</div><br>
              <input class="controlbutton" id="StartRanger" type=button value="Startup Ranger" onclick="Ranger.Startup();">
              <input class="controlbutton" id="EnableRanger" disabled type=button value="Enable Ranger" onclick="Ranger.EnableOptions();">
              <input class="controlbutton" id="StartFeeding" disabled type=button value="Start Feeding" onclick="Ranger.StartFeeding(0,0);">
              <input class="controlbutton" id="StopFeeding" disabled type=button value="Stop Feeding" onclick="Ranger.StopFeeding();">
              <input class="controlbutton" id="ChangeOptions" disabled type=button value="Change Options" onclick="Ranger.PrepareToChangeOptions();">
              <input class="controlbutton" id="Shutdown" disabled type=button value="Shutdown Ranger" onclick="Ranger.Shutdown();">
         </div>
         <div id="content">
              <div id="UserInstructions">Press 'Startup Ranger' to initialize the Ranger control</div>
              <br>
              <div id="MICR"></div>
              <br>
              <div id="PIC"></div>
         </div>
         <div id="footer"><h1>Ranger Control</h1></div>
    </div>
    them jsf code:
    <f:view>
    <OBJECT ID="Ranger"
        CLASSID="CLSID:1C5C9095-05A8-11D4-9AF9-00104B23E2B1">
    </OBJECT>   
      <af:document id="d1" title="Fiche Bordereau">
        <af:messages id="m1"/>
        <af:form id="f1">
          <af:pageTemplate viewId="/tempCompens.jspx" id="pt1">
           <af:resource type="javascript">
            // Transport new state, fired every time the State changes on the control
            // input params , are the new state and the previous state
            //alert(newState);
            var RangerTransportStates = {TransportUnknownState: -1, TransportShutDown: 0, TransportStartingUp: 1,
                                  TransportChangeOptions: 2, TransportEnablingOptions: 3, TransportReadyToFeed: 4,
                                  TransportFeeding: 5, TransportExceptionInProgress:6, TransportShuttingDown: 7};
            ok =false;
            var i = 0;
            if(newState == RangerTransportStates.TransportShutDown)
                document.getElementById('btn_demarre').disabled = false;
                document.getElementById('btn_active').disabled = true;
                document.getElementById('btn_arretscan').disabled = true;
                document.getElementById('btn_scan').disabled = true;
                document.getElementById('btn_changetat').disabled = true;
                document.getElementById('btn_arret').disabled = true;
                document.getElementById('UserInstructions').value = "Appuyer sur Demarrer pour initiliser le scanner"
            if(newState == RangerTransportStates.TransportChangeOptions)
                document.getElementById('btn_demarre').disabled = true;
                document.getElementById('btn_scan').disabled = true;
                document.getElementById('btn_active').disabled = false;
                document.getElementById('btn_arret').disabled = false;
                document.getElementById('UserInstructions').value = "Demarrage... Appuyer sur Activer pour preparer le scanning "
                ok = false;
            if(newState == RangerTransportStates.TransportReadyToFeed)
                document.getElementById('btn_active').disabled = true;
                document.getElementById('btn_arretscan').disabled = true;
                document.getElementById('btn_scan').disabled = false;
                document.getElementById('btn_changetat').disabled = false;
                document.getElementById('btn_arret').disabled = false;
                document.getElementById('UserInstructions').value = "Pret a scanner.   Appuyer sur Scanner pour lancer le scanning"
                ok = true;
            if(newState == RangerTransportStates.TransportFeeding)
                document.getElementById('btn_scan').disabled = true;
                document.getElementById('btn_changetat').disabled = true;
                document.getElementById('btn_arret').disabled = true;
                document.getElementById('btn_arretscan').disabled = false;
                document.getElementById('UserInstructions').value = "Scanning...  Appuyer sur Arret scanning pour stopper le scanning"
            getstatus();
           </af:resource>
           <af:resource type="javascript">
            //Fired when the item has been fed into the pocket
                var RangerSides = {TransportFront: 0, TransportRear: 1};
                var RangerImageColorTypes = {ImageColorTypeBitonal:0, ImageColorTypeGrayscale: 1, ImageColorTypeColor: 2};
            //alert(Ranger.GetGenericOptionFileName());
                Ranger.SetGenericOption("OptionalDevice","NeedFrontImage1",true);
                Ranger.SetGenericOption("OptionalDevice","NeedRearImage1",true);
                document.getElementById('cmc7').value = 'CMC7= '+Ranger.GetMicrText(1);
                var cmc7 = trim(Ranger.GetMicrText(1));
                cmc7 = cmc7.replace(" ","_");
                cmc7 = cmc7.replace(" ","_");
            //cmc7 = cmc7.substring(0,15);
                cmc7R = cmc7+"_R.jpg";
            //alert(Ranger.GetImageAddress(RangerSides.TransportFront, RangerImageColorTypes.ImageColorTypeGrayscale))
                function trim(myString)
                    return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
                temp = Ranger.SaveImageToFile(RangerSides.TransportFront, RangerImageColorTypes.ImageColorTypeGrayscale, "C:\\Documents and Settings\\Koffi Ernest\\Mes documents\\NetBeansProjects\\Scan-project\\web\\"+cmc7R);
                window.onload = function()
                  document.getElementById("verso").src = monfichierV();
                function monfichierR()
                //  nomfichier = nomfichier+"_R.jpg";
                    var nomfichier = trim(Ranger.GetMicrText(1))+"_R.jpg";
                    return  nomfichier
                cmc7V = cmc7+"_V.jpg";
                temp = Ranger.SaveImageToFile(RangerSides.TransportRear, RangerImageColorTypes.ImageColorTypeGrayscale,"C:\\Documents and Settings\\Koffi Ernest\\Mes documents\\NetBeansProjects\\Scan-project\\web\\"+cmc7V);
                window.onload = function()
                    document.getElementById("verso").src = monfichierV();
                function monfichierV()
                    var nomfichierV = trim(Ranger.GetMicrText(1))+"_V.jpg";
                    return nomfichierV
                function getRImageUrl(img)
                    var imageSrc = trim(Ranger.GetMicrText(1))+"_R.jpg";
                    if(img.src != imageSrc)
                    // don't get stuck in an endless loop
                    img.src = imageSrc;
                function getVImageUrl(img)
                 var imageSrc = trim(Ranger.GetMicrText(1))+"_V.jpg";
                 if(img.src != imageSrc)
                 { // don't get stuck in an endless loop
                  img.src = imageSrc;
            document.getElementById('recto').source = cmc7R;
            document.getElementById('verso').source = cmc7V;
            getstatus();
           </af:resource>
            <af:resource type="javascript">
                 document.getElementById('status').value = Ranger.GetTransportStateString();
            </af:resource>
            <f:facet name="temp">
              <af:panelSplitter id="ps1" splitterPosition="329"
                                inlineStyle="width:709px;">
                <f:facet name="first">
                  <af:panelGroupLayout layout="scroll"
                                       xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                                       id="pgl5">
                    <af:panelGroupLayout id="pgl1">
                      <af:outputText value="Saisie des informations du bordereau"
                                     id="ot1"
                                     inlineStyle="font-size:small; font-family:inherit; color:Gray; font-weight:bold;"/>
                    </af:panelGroupLayout>
                    <af:panelFormLayout id="pfl1">
                      <f:facet name="footer">
                        <af:panelGroupLayout id="pgl4" layout="horizontal">
                          <af:commandButton text="Annuler" id="cb4"/>
                          <af:spacer width="5" height="10" id="s14"/>
                          <af:commandButton text="Scanner" id="cb5"
                                            action="success"/>
                        </af:panelGroupLayout>
                      </f:facet>
                      <af:spacer width="10" height="30" id="s2"/>
                      <af:panelGroupLayout id="panelGroupLayout1"
                                           layout="horizontal" valign="middle">
                        <af:inputText label="N° de compte                   " id="it1"/>
                        <af:spacer width="10" height="10" id="s16"/>
                        <af:commandButton text="..." id="cb3"/>
                      </af:panelGroupLayout>
                      <af:spacer width="5" height="3" id="s12"/>
                      <af:panelGroupLayout id="pgl2" layout="horizontal"
                                           valign="middle">
                        <af:inputText label="Nom du client         " id="it3"/>
                      </af:panelGroupLayout>
                      <af:spacer width="5" height="3" id="s17"/>
                      <af:panelGroupLayout id="pgl11" layout="horizontal"
                                           valign="middle">
                        <af:inputText label="N° bordereau    " id="it4"/>
                        <af:spacer width="5" height="10" id="s11"/>
                        <af:commandButton text="New" id="cb1"/>
                        <af:spacer width="2" height="10" id="s13"/>
                        <af:commandButton text="Find" id="cb2"/>
                      </af:panelGroupLayout>
                      <af:spacer width="5" height="3" id="s18"/>
                      <af:panelGroupLayout id="pgl3">
                        <af:inputText label="Nbre de chèque" id="it2"/>
                        <af:spacer width="5" height="3" id="s19"/>
                        <af:inputDate label="Date d'operation                  " id="id1"/>
                      </af:panelGroupLayout>
                      <af:spacer width="1000" height="10" id="s1"/>
                    </af:panelFormLayout>
                  </af:panelGroupLayout>
                </f:facet>
                <f:facet name="second">
                  <af:panelGroupLayout layout="scroll"
                                       xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                                       id="pgl6">
                    <af:outputText value="Resultat scanning" id="ot2"
                                   inlineStyle="font-size:small; font-weight:bold; color:Gray;"/>
                    <af:panelTabbed id="pt2"
                                    inlineStyle="height:498px; width:680px;">
                      <af:showDetailItem text="Scanning" id="sdi1">
                        <af:panelSplitter id="ps2" splitterPosition="103"
                                          inlineStyle="width:433px; height:436px;">
                          <f:facet name="first">
                            <af:panelGroupLayout id="pgl7" layout="vertical">
                              <af:outputText value="Liste de contrôles" id="ot3"
                                             inlineStyle="font-weight:bold; color:Gray;"/>
                              <af:spacer width="10" height="10" id="s20"/>
                              <af:outputText id="status"/>
                              <af:spacer width="10" height="10" id="s8"/>
                              <af:commandButton text="Demarrer      "
                                                id="btn_demarre">
                                <af:clientListener type="click"
                                                   method="Ranger.Startup()"/>
                              </af:commandButton>
                              <af:spacer width="10" height="10" id="s7"/>
                              <af:commandButton text="Activer              "
                                                id="btn_active"
                                                disabled="true">
                                <af:clientListener method="Ranger.EnableOptions()"
                                                   type="click"/>
                              </af:commandButton>
                              <af:spacer width="10" height="10" id="s6"/>
                              <af:commandButton text="Scanner       "
                                                id="btn_scanne"
                                                disabled="true">
                                <af:clientListener method="Ranger.StartFeeding(0,0)"
                                                   type="click"/>
                              </af:commandButton>
                              <af:spacer width="10" height="10" id="s3"/>
                              <af:commandButton text="Arrêt Scan   "
                                                id="btn_arretscan"
                                                disabled="true">
                                <af:clientListener method="Ranger.StopFeeding()"
                                                   type="click"/>
                              </af:commandButton>
                              <af:spacer width="10" height="10" id="s4"/>
                              <af:commandButton text="Changer Etat"
                                                id="btn_changetat"
                                                disabled="true">
                                <af:clientListener method="Ranger.PrepareToChangeOptions()"
                                                   type="click"/>
                              </af:commandButton>
                              <af:spacer width="10" height="10" id="s5"/>
                              <af:commandButton text="Arrêter         "
                                                id="btn_arret"
                                                disabled="true">
                                <af:clientListener method="Ranger.Shutdown()"
                                                   type="click"/>
                              </af:commandButton>
                            </af:panelGroupLayout>
                          </f:facet>
    ....Edited by: nesta on 21 juil. 2010 07:07

  • Any ideas on how to incorporate a simple database into my website?

    Firstly I am to create a website that will survey the user on what their ideal laptop would be (each answer would relate to a certain brand or model of laptop); once the user has filled out the survey I went to be able to tally up their results to work out which record in the pre-existing database would be best suited...
    This would be a simplified example,
    Which brand would you prefer:
    Apple  ( )        HP      ( )         Sony    ( )
    Price range:
    100   ( )       200    ( )     300     ( )
    I have attempted to just 'search the database' since each answer has is representing a record in the database; however this does not take into account various answers across the survey (Will only search and display for the price, while ignoring what brand, etc.)
    The database is on phpmyadmin, whether that makes any difference.
    Perhaps there is a simple line of code that will handle all this, but I'm relatively new to the whole thing so any help would be greatly appreciated.

    Having a bit of trouble getting it to work, would you mind looking over my code to see where I've messed up?
    <?php require_once('../Connections/survey.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $colname_Brand = "-1";
    if (isset($_GET['Brand'])) {
      $colname_Brand = $_GET['Brand'];
    mysql_select_db($database_survey, $survey);
    $query_Brand = sprintf("SELECT * FROM ideal WHERE Brand = %s", GetSQLValueString($colname_Brand, "text"));
    $Brand = mysql_query($query_Brand, $survey) or die(mysql_error());
    $row_Brand = mysql_fetch_assoc($Brand);
    $totalRows_Brand = mysql_num_rows($Brand);
    $colname_Price = "-1";
    if (isset($_GET['Price'])) {
      $colname_Price = $_GET['Price'];
    mysql_select_db($database_survey, $survey);
    $query_Price = sprintf("SELECT * FROM ideal WHERE Price = %s", GetSQLValueString($colname_Price, "text"));
    $Price = mysql_query($query_Price, $survey) or die(mysql_error());
    $row_Price = mysql_fetch_assoc($Price);
    $totalRows_Price = mysql_num_rows($Price);
    $colname_Rating= "-1";
    if (isset($_GET['Rating'])) {
      $colname_Rating = $_GET['Rating'];
    mysql_select_db($database_survey, $survey);
    $query_Rating = sprintf("SELECT * FROM ideal WHERE Rating = %s", GetSQLValueString($colname_Rating, "text"));
    $Rating = mysql_query($query_Rating, $survey) or die(mysql_error());
    $row_Rating = mysql_fetch_assoc($Rating);
    $totalRows_Rating = mysql_num_rows($Rating);
    ?>
    <!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=utf-8" />
    <title>Search Results</title>
    </head>
    <body>
    <h1> Survey results</h1>
    <?php
        $temp = $totalRows_Results;
        if ($temp == 0) { echo "No Records Found"; }
    ?>
    <table width="200" border="1">
      <tr>
        <td>id</td>
        <td>Brand</td>
        <td>Name</td>
        <td>Price</td>
        <td>Rating</td>
        <td>Purpose</td>
      </tr>
      <?php do { ?>
      <tr>
        <td><?php echo $row_Results['id']; ?></td>
        <td><?php echo $row_Results['Brand']; ?></td>
        <td><?php echo $row_Results['Name']; ?></td>
        <td><?php echo $row_Results['Price']; ?></td>
        <td><?php echo $row_Results['Rating']; ?></td>
        <td><?php echo $row_Results['Purpose']; ?></td>
      </tr>
      <?php } while ($row_Results = mysql_fetch_assoc($totalRowResults)); ?>
    </table>
    <br />
    <a href="survey.html">Back to survey</a>
    </body>
    </html>
    <?php
    mysql_free_result($Results);
    ?>

  • Simple javascript code?

    hello -
    i'm trying to insert some simple javascript into a flash file
    to test how it works.
    within the html file, i have this code:
    <script language="JavaScript">
    function mycallback(value) {
    alert("hello world! - " + value);
    </script>
    what should my action/javascript code look like in my flash
    file?
    here is just a html version of how i want it to work:
    http://www.dkwong.com/example_js.html
    thanks!

    Well, more the advanced features you need, you'll have to compromise somewhere! The code on the link I gave you is about 5KB. When you minify it, it is about 1.4KB.
    Copy the code, use http://jscompress.com/ to minify the code. Include it in your page then.
    -ST

  • How Can I Set a Javascript Value into an Attribute of BSP PAGE

    Hi
    Can anyone tell me.
    How Can I Set a Javascript Value into an Attribute of BSP PAGE

    Hi Mithlesh,
    javascript runs on client side and you cannot assign the value to a Page attribute directly.
    As a workaround,you can use an Inputfield,hidden if required,and set the value using javascript.Then the form will have to be submit to be able to read the value in onInputProcessing and then can be assigned to any variable.
    In Layout
    <head>
    <script language="javascript">
    function pass()
       txt1 = document.getElementById("ip_mrf");
       txt.value = "hello" ;
    </script>
    </head>
    <htmlb:inputField  id="ip_mrf"
                               value="<%=mrf_number%>"
                               visible="FALSE"/>
    in onInputProcessing
    cha1 = request->get_form_field( 'ip_mrf' ).
    where cha1 is the page attribute
    hope this helps,
    Regards,
    Siddhartha
    Message was edited by: Siddhartha Jain

  • How to pass a jsp variable into javascript??

    <p><%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <p><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <p><html>
    <p><c:set var="binrmapi" value="http://localhost/paas-api/bingorooms.action;jsessionid=XXXXXX?userId=TEST2&sessionId=1&key=1" />
    <p><c:import var="testbinrm" url="${fn:replace(binrmapi, 'XXXXXX', jsessionid)}"/>
    <p><c:set var="tuples" value="${fn:split(testbinrm, '><')}" />
    <p>Time until next game
    <p><c:forEach var="tuple" items="${tuples}">
    <p><c:if test="${fn:contains(tuple, 'row ')}">
    <p> <p><code>
    <p> <c:set var="values" value="${fn:split(tuple, '=\"')}" />
    <p> <font color="blue">
    <p> <c:out value="${values[17]}" />
    <p><c:set var="remainingtime" value="${values[17]}" />
    <p> </font>
    <p> </code>
    <p></c:if>
    <p></c:forEach>
    <p><form name="counter"><input type="text" size="8" name="d2"></form>
    <p><script>
    <p>var milisec=0
    <p>var seconds=eval("document.myForm.remaining").value;
    <p>function display(){
    <p> if (milisec<=0){
    <p> milisec=9
    <p> seconds-=1
    <p>}
    <p>if (seconds<=-1){
    <p> milisec=0
    <p> seconds+=1
    <p> }
    <br>else
    <p> milisec-=1
    <p> document.counter.d2.value=seconds+"."+milisec
    setTimeout("display()",100)
    <p>}
    <p>display()
    <p></script>
    <p></body>
    <p></html>
    <p>This is my code that i was working on, in the jsp part of the script, i get a api call and save a value of time in the variable remainingtime.. and in the javascript, i try to have a countdown clock counting down the remaining time.. but i guess it doesnt work.. how can i get that working? thanks alot
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001

    Re: How to pass a jsp variable into javascript??Here is the sameple one, hope it will solves your problem.
    <html>
    <body>
    <form name=f>
    <%!
    String str = "A String"
    %>
    <script>
    var avariable = <%=str%>
    <script>
    </form>
    </body>
    </html>
    Let me know if you face any problem

  • How do i show javascript into  java application?

    hi
    ( please help me!!!!!!!!!!!!!!!!!)
    how do i run javascript into java application ?( looks like microsoft frontpage )
    thank you ?

    There is a JavaScript interpreter called Rhino implemented in Java, maybe you can use it: http://www.mozilla.org/rhino/

  • Hello. i have a 57 min mts video that i'd like to cut into several short videos. simple, probably. how do i separate this video into sections?

    hello. i have a 57 min mts video that i'd like to cut into several short videos. simple, probably. how do i separate this video into sections?

    Press F1 and type in Subclips.

  • Embedding javascript into iWeb?

    Is there a way to embed some Javascript into an iWeb '09 site via something like a snippet?

    you can add javascript to iweb page in many ways, but it depends on the complexity of the javascript and the complexity of the template that you use.
    the typical process of adding javascript in HTML Snippet is one of the following:
    1) pasting the code in HTML Snippet and hope that it'll work.
    2) design a page (probably a simple template) then:
    a) publish it.
    b) look for the element that you want to apply javascript to.
    c) hard code the javascript.
    d) add it using HTML Snippet.
    e) publish it (again) and hope that it'll work.
    this process is clumsy as I described because you have no control on how iweb assigns id and class to an element. I'd done this back in iweb1 (three years ago).
    this process will not work when you try to apply to a complex template...
    say you like to apply your javascript to the thumbnails in the photos page template, well you can't because there is nothing there to see in the above steps a and b
    unless you have complex javascript to deal with them. I'd done this back in iweb2 (almost two years now).
    that said, as of iweb3... you can build (real) iweb3 widgets to add complex javascript to just about anything to any page template, but you need to know HTML, CSS, JavaScript, DOM, and how iweb works
    here are my examples:
    http://www.cyclosaurus.com/Home/Cyclosaurus.html <-- StatCounter
    <a class="jive-link-external-small" href="http://">http://www.cyclosaurus.com/Home/CyclosaurusBlog/Archive.html <-- my own iweb blog tag cloud
    <a class="jive-link-external-small" href="http://">http://cyclosaurus.com/iWeb3Widgets/Lytebox/Photos.html
    http://cyclosaurus.com/iWeb3Widgets/Highslide/PhotosPage.html
    http://cyclosaurus.com/iWeb3Widgets/Couloir/Photos.html

  • How do I make web shortcuts into start screen tiles that can be pushed to all users profile on a computer in Windows 8.1 enterprise?

    We are trying to roll out Windows 8.1 Enterpise in our school system (K-12).
    The focus of this question is how do we take an internet web based shortcut and make it into a screen tile (on the start screen) which will appear for any user's start screen that logs on to the computer?
    The details:
    We came upon a great paper that's entitled "Customize Windows 8.1 Start Screens by Using Group Policy".
    By applying this paper we were able to accomplish our first goal: Lock down the start screen so no user could change it. We accomplished this by using the Start Screen Layout policy setting laid out in the paper.
    Our second goal: to customize the start screen is only half way met. We can set up the start screen the way we want and then export the .xml file. We are able to "reimport" the .xml file when the new user logs in. The installed programs
    will appear on the Start Screen but not the internet based web shortcuts that were on the inital setup start screen.
    (FYI - tried creating these tiles by running the start screen internet explorer app to the intended address and pinning them to the start screen. At this time trying to figure if there is a place to put desktop internet short cuts into a directory to make
    them appear on the Start Screen).
    We can see that the directory: C:\ProgramData\Microsoft\Windows\Start Menu\Programs is a place for program files to appear on the start screen. Is there a location web based shortcuts can be placed to cause them to automatically appear on the start
    screen for every user as well? If not how do we accomplish getting these into tiles for every user logging in?
    Sorry for the lengthy explanation. Hopefully it gets our question answered and helps others out there in the same boat!

    Karen-
    Results: Did not work. The web based shortcuts did not appear.
    Below is the steps taken with your tips incorporated. (Again it's lengthy sorry about that, but anyone can recreate what was done here. Maybe someone can see something left out by doing/reviewing it).
    Here is what was done:
    1. Installed a fresh install of Windows 8.1 enterprise on a pc. No updates were ran.
    2. During setup created the admin account.
    3. Logged into the account a simple start screen was arranged and setup by:
    Starting desktop Internet Explorer. Going to Technet's website. Clicked tools and then selecting "Add site to Apps" from the drop down menu. Went to Apps screen, right clicked and pinned it to start screen. Repeated this procedure with an
    educational web based site.
    Right clicked a few provisioned apps and unpinned them from the start screen.
    Made a few groups and labeled them. Web based shortcuts were arranged with one provisioned app in that particular group.
    4. Opened a Powershell, right clicked it and ran as administrator. Typed the following:
    export-startlayout -path C:\Users\Public\Master.xml -as xml
    (Master is the name chosen for this test .xml file and was put in a location all users would have privelages to access it).
    5. Opened the command prompt and right clicked and "ran as administrator", typed in gpedit.
    6. In the Local Group Policy under User Configuration, under Start Menu and Taskbar I choose the Start Screen Layout.
    7. Enabled the policy and typed in: C:\Users\Public\Master.xml for the Start Layout File.
    8. Opened computer management, under Local Users and Groups I chose Users, right clicked in the middle screen and created a new user called Alpha.
    9. Logged out of the inital account and logged into newly created Alpha account.
    10. When the Alpha account logged in the start screen came up with everything changed in the inital account but no web based shortcuts were found on the start screen or App view.

  • How to apply Muse (webfont) styles to BC Blogs/Contact Forms?

    Hi all.
    So my site (designed in Muse) is pretty much ready, except for my blog and a couple of forms. I've just gone through making it my partner site, replacing the so-called "bre-built" default site. That process was very, very simple, but BC Support told me it would be much more complicated than it needed to be - it wasn't! I was able to simply publish via Muse to my partner site domain and everything worked fine...
    Anyway... Headers in my site use the "Bebas Neue" webfont selected from within Muse (I assume this is a Typekit font?), at 30pt and a custom colour #B10505. Body text is simply "Trebuchet" (a standard font) in black at 12pt. Now, I'm aware that not everything designed in Muse shows up "as shown" when doing any editing in the back-end of BC. I've just begun following through the tutorial for setting up BC modules on a Muse site and have gotten to the "Inspect Element" stage...
    This is where I've hit a snag. This video: http://www.businesscatalyst.com/bc-blog/adding-business-catalyst-features-to-your-muse-sit es (with the blog part starting near the end of 19 minutes) clearly uses a standard font and not a webfont, so when I'm inspecting with Firebug, what's shown in the video doesn't show up the same in reality for me. This is because a standard font is applied in Muse designed sites where a webfont is in use, and the webfont simply "masks" the standard font (if I'm not mistaken?)...
    I've read this topic: http://forums.adobe.com/message/5480712#5480712 which pretty much asks the same question I'm asking, but this guy clearly has more knowledge (or maybe more common sense) than me, so I'm asking it in a new topic here...
    Can someone please walk me through (step-by-step) how to apply Muse selected webfont CSS styles to the relevant files in BC so that my blog shows up with a consistent look and feel to the rest of my site? I'll literally need every step walking through with minimal jargon if possible - this area of web design is not my forte!
    I suppose I'd also like the same process walking through for contact forms if possible? Alongside the header font, I've got a custom styled, beveled button made on a standard Muse contact form that I'd like replicating on a BC-made form.
    I'm sure once I understand this process, I'll be able to apply this to any BC module; I just need that initial helping hand that neither the BC team or the Muse team seem to want to reference in their tutorial videos!
    Any help would be greatly appreciated! Thanks in advance!

    Hi
    So, are these links in lieu of a full walkthrough, to help me better understand until if/when you get the time to explain?
    The cssbasics.com link isn't working, FYI.
    Looking through the typekit page, it seems fairly straight forward. Is this the same set of fonts Muse uses?
    If so, theoretically do I just need to copy the snippet of code from the typekit site for my desired font (Bebas Neue) and paste it into the modulestylesheet.css file? Where? At the bottom of everything else? Presumably commenting what it is? and define that I want to use that as a header font? Can you walk me through exactly what I need to put for that?
    Then I guess I just need to follow the rest of the video tutorial I linked above?
    Or is there a little more to it than that?
    Would I need to do the same to define trebuchet as the body font, or is there a different block of code I need for that, since that's not a webfont?
    Sorry for being so slow with it!

  • How to apply different CSS styles to different table cells?

    I have an h:dataTable table and I would like to apply different CSS styles to different table cells depending on their content. If I were doing JSP I would probably have a <c:if> test on the cells, and give them a style name depending on contents, and then define the styles in a separate style sheet. Is there a way in JSF to do the equivalent? Thanks.

    mitchgart wrote:
    BalusC wrote:
    How to achieve a cell-specific style is already answered in my 1st reply of this topic.That tells how to apply a style to the text (or other content) inside a cell but not how to apply a style to the <td> as a whole. It would work for something like text font or text color but not cell border.
    I'm thinking I can mark the content somehow and then have javascript traverse the DOM, find marked content, and traverse outward to the enclosing <td>. Is there a better way?BalusC already spoke about rowClasses and columnClass attributes, I assume those are insufficient.
    The Tomahawk dataTable component has the rowStyleClass and rowStyle attributes for assigning CSS to the HTML tr tag. One is allowed to reference the row data variable when assigning values to these. However, see https://issues.apache.org/jira/browse/TOMAHAWK-523 for workarounds to bugs in some implementations.
    The Tomahawk column component has the styleClass and style attributes for assigning CSS to the HTML td tag. These also may reference the row data variable.

  • How to apply CSS style values to h:messages ?

    Hi Folks,
    I'm quite new to JSF development. What I'm currently trying to do, is to apply a CSS style for a <h:messages> tag:
    <h:messages globalOnly="true" style="color: red;" layout="table" />Unfortunately the style "color: red;" is not being applied to the generated HTML table (or list):
    <table>
       <tr>
          <td>My Error Message!</td>
       </tr>
    </table>But I assume the generated HTML should rather look something like this:
    <table style="color: red;">
       <tr>
          <td>My Error Message!</td>
       </tr>
    </table>I'm using MyFaces 1.1.3 with Tomcat 5.5. Is this maybe a bug in MyFaces?
    Salute

    We speak HTML here.
    Let's see what you have tried so far, please.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Buescorpmtf" <[email protected]> wrote in
    message
    news:g3p16e$j03$[email protected]..
    >I have been trying to apply a simple CSS style of a
    rounded border to my
    >web
    > pages. I received the coding and images from
    http://www.roundedcornr.com.
    > I
    > downloaded the images and linked them in the CSS style
    editor. I tried to
    > apply the style to the webpage/container, but it won't
    apply. This seems
    > like
    > a pretty simple task, but I can not get it done.
    >
    > Does anyone know how to do this? Step by Step and in
    plain English? :)
    >
    > Thanks
    >

  • Slow performance during Apply Request Values Phase of JSF lifecycle

    Dear all,
    I found that my application is sucked at the Apply Request Values Phase of JSF lifecycle when I submit the page. (Totally spend 1 min to pass this phase)
    In the application, there is around 300 input fields in the page. Who know how can I ehance the performace?
    Thanks.

    Thanks a lot for your help. Maybe I explain more about my current structure
    I need to develop a input form for course instructor to input students' assignment / examination result (max 9 assignments and 1 examination).
    so that I have below coding:
    *1. bean to store marks of a student*
    public class Mark {
    private String studentID = "";
    private String mark1 = "";
    private String mark9 = "";
    private String markExam = "";
    //getter & setter of above properties
    public void setMark1(String mark1) {
    this.mark1 = mark1;
    public String getMark1() {
    return this.mark1;
    *2. backing bean*
    public class markHandler {
    ArrayList<Mark> marks = new ArrayList<Mark>();
    //getter & setter of above property
    //method to retrieve list of student (this will be the action before go in mark input page)
    public void getStudentList() {
    //get student list from database
    for(int i = 0 ; i < studentCount; i++){
    //initial mark of student
    Mark mark = new Mark();
    mark.setStudentID(studentID);
    mark.setMark1("");
    mark.setMarkExam("");
    //put into arraylist
    marks.add(mark);
    *3. mark input page*
    <html>
    <h:dataTable value="#{markHandler.marks}" var="e">
    <column>
    <h:output value="#{e.studentID}" />
    </column>
    <column>
    <h:input id="mark1" value="#{e.mark1}" />
    </column>
    <column>
    <h:input id="mark1" value="#{e.markExam}" />
    </column>
    </h:dataTable>
    <h:commandButton action="#{markHandler.save} />
    </html>
    When I submit the page, It seems that there is a long time spent at the input field of datatable at Apply Request Values Phase. (I use Phase Listeners to test the time difference before & after phase)
    Pls help. Thanks.
    Edited by: Daniel_problem on Aug 15, 2008 10:34 AM
    Edited by: Daniel_problem on Aug 15, 2008 10:36 AM

  • How to apply mvc pattern  to mastermind game coding?

    Hello,
    I am trying to create the mastermind board. i want to know how to apply the MVC pattern to the design
    View -- creating the board
    Model --??
    Controller --??
    I am not able to understand what should be in the model and what shud be in the controller.
    Can anybody help
    Thanks,
    Manju

    * Model - The model represents enterprise data and the business rules that govern access to and updates of this data. Often the model serves as a software approximation to a real-world process, so simple real-world modeling techniques apply when defining the model.
    * View -The view renders the contents of a model. It accesses enterprise data through the model and specifies how that data should be presented. It is the view's responsibility to maintain consistency in its presentation when the model changes. This can be achieved by using a push model, where the view registers itself with the model for change notifications, or a pull model, where the view is responsible for calling the model when it needs to retrieve the most current data.
    * Controller - The controller translates interactions with the view into actions to be performed by the model. In a stand-alone GUI client, user interactions could be button clicks or menu selections, whereas in a Web application, they appear as GET and POST HTTP requests. The actions performed by the model include activating business processes or changing the state of the model. Based on the user interactions and the outcome of the model actions, the controller responds by selecting an appropriate view.
    http://java.sun.com/blueprints/patterns/MVC-detailed.html

Maybe you are looking for

  • TemporaryQueue communication - Request/Response messaging in JMS

    Not able to make simple JMS application with the following steps run Start the Server Start the Client The Client creates a temporary queue and sends the name to the server Server receives message and sends a test message back. Client NEVER receives

  • OracleXE and Oracle10gAS Forms-Reports Services

    Hello, Can they co-exist in a testing - development environment of Forms-Reports 10g Application ? Are there other alternatives of prototyping (without having to think about licensing costs) a Forms-Reports app and make a short demonstration to the c

  • Help! Toning in bridge and once we make corrections to images it does not stay

    Good afternoon everyone - We are currently processing a wedding in CS5 and Bridge. Once my assistant tones the images it does not retain the information and reverts to a random horrid color setting. We have never seen this before - in 100 of weddings

  • 10.4.7 sleep problem "solved"...kind-of...

    Hello, all. I was having a problem w/ my PowerMac G5 after the 10.4.7 update - it would not go to sleep. The screen would freeze and the computer would not respond...and it wouldn't sleep. Eventually, the fans would crank up to full blast and that's

  • Enhance product search

    Hi, I would like to add my own search criteria to the standard product search. I figured that the used component is 'PRD01QR' and thus I enhanced it. The corresponding view is 'PRD01QR/Search'. I created a new context node that corresponds to my set