How to get a score in javascript

form.jpg

Hello world

Thanks to a user, I have had this example. I used it to make a quiz. A user replies to this questionnaire and receive its partition. In this example, get the different languages in the right order (for example: Russian, French, English and Italian). Until now it works, but I do not know how to do the javascript code to get the score.

The button (click_event) script:

for (var i = 0; i < ListBox1.length; i ++)

{

If (ListBox1.getItemState (i))

{

ListBox2.addItem (ListBox1.getDisplayItem (i), ListBox1.getSaveItem (i));

}

}

for (var i = ListBox1.length; i > = 0; i--)

{

If (ListBox1.getItemState (i))

{

ListBox1.deleteItem (i);

}

}

Script of the list box (change_event)

for (var i = 0; i < this.items.nodes.length; i ++)

{

If (xfa.event.change is this.items.nodes.item (i) .value)

{

XFAUtil.setProperty (Thi, "selectedIndex", I, XFAUtil.ContentType.Integer);

break;

}

}

The total box script (? _event)

Now it's your turn!

Any help will be appreciated

Thank you very much

I don't know exactly how you want to mark the languages. Something like: if they are in alphabetical order, the user gets 4 points for the first answer, 3 for the second, etc. Or if they are all in the right order, then the user gets 10 points. Or the user meets lnguages how he speaks and gets 1 point for one language, 2 points for both languages, etc. So, here are a few examples.

Script to calculate the total area event:

to give a score based on alphabetical order individually

this.rawValue = 0;

If (ListBox2.getDisplayItem (0) == 'English') this.rawValue = parseInt (this.rawValue) + 4;

If (ListBox2.getDisplayItem (1) == 'French') this.rawValue = parseInt (this.rawValue) + 3;

If (ListBox2.getDisplayItem (2) == "Italian") this.rawValue = parseInt (this.rawValue) + 2;

If (ListBox2.getDisplayItem (3) == 'Russian') this.rawValue = parseInt (this.rawValue) + 1;

or

to give a score based on the order alphabetical, if everything is correct

this.rawValue = 0;

If (ListBox2.length == 4 & ListBox2.getDisplayItem (0) == 'English' & ListBox2.getDisplayItem (1) == 'French' & ListBox2.getDisplayItem (2) == "Italian") this.rawValue = 10;

or

to give a score based on the number of languages spoken, 1, 3, 6, 10 pts.

this.rawValue = 0;

for (var i = 0; i)

I hope that these examples cover this kind of notation you can do.

Tags: Adobe LiveCycle

Similar Questions

  • How to get inputtext inputvalue using javascript

    How to get inputtext inputvalue using javascript?
    and how to judge if his being filled or a string empty

    function method1 (event) {}
    Event.Cancel ();
    var value = event.getSource ().findComponent('inputTextID').getValue ();
    }

  • How to get the score of the player with Adobe SDK ANE GameCenter Gaming

    Hello! I need your help with something that should be super easy, but I couldn't really find anywhere.

    How can I get scores of adobe gamecenter with ane local player, game development kit? There is a requestScores, but in the only parameter, it would be wise to specify the type of player (playerScope:String) I have only 2 options to specify (friends or Global). No option of local communities. Default value is global...

    When you use GameCenter, wants to show the player when he beat the best scores of his own GameCenter and print the current on a results screen record when he's not beat him. But I cannot find anywhere how to get through this DONKEY.

    Maybe you can´t chack users score to compare with other scores of users. I know that you can compare your score with the last record. In this way, I said, you can display only a message only if the score is kept, in this way, you can display a screen saying new high score, but this new high score will be his best score, high score of not all users.

  • How to get a score of navigation list CSS working according to the needs?

    I am in a bind with a left navigation. I thought it was ok, then realized the buttons together were not selectable, only the text. And hover does not work properly. It looks like right when you hover over the text, but not when you are out of the side of it. What is there in the text is a normal state, "showing through". Being very new to this I could sure use help and learn from him, too. Thanks in advance! Please let me know if you need more information.

    Kind regards

    SAL

    URL: http://www.sallyaverill.com/bom/

    CSS for the nav:

    {.navdiv}
    Width: 200px;
    height: 590px;
    float: left;
    }

    {.leftnavigation}
    Width: 192px;
    margin: 70px 0px 0px 0px;
    padding-left: 8px;
    / * float: left; */
    list-style-type: none;
    }

    . LeftNavigation has, .leftnavigation li {}
    left margin: 0px;
    Width: 171px;
    padding-left: 0px;
    padding-top: 5px;
    padding-right: 10px;
    padding-bottom: 5px;
    / * float: left; */
    color: #392F9D;
    do-size: 10px;
    make-weight: bold;
    do-family: Verdana, Arial, Helvetica, without serif.
    text-decoration: none;
    background-image: url(images/nav_normal.jpg);
    background-repeat: repeat-x;
    background-position: 0px 0px;
    }

    . LeftNavigation li {}
    float: left;
    background: url(images/nav_normal.jpg) top left no-repeat;
    border-bottom: 1px solid #999;
    line-height: 150%;
    padding-left: 10px;
    }

    . LeftNavigation li: visited {}
    color: # 66;
    }

    . LeftNavigation li: hover {}
    color: #fffff;
    background-image: url(images/nav_down.jpg);
    }

    . LeftNavigation a: visited {}
    color: # 66;
    }
    . LeftNavigation a: hover {}
    color: #ffffff;
    background-image: url(images/nav_down.jpg);
    }

    Replace what you have now with this:

    /* LEFT NAVIGATION */
    
    .navdiv {
    width: 200px;
    float: left;
    }
    
    .leftnavigation {
    width: 190px;
    margin: 70px 0px 0px 0px;
    padding-left: 8px;
    }
    
    .leftnavigation li {
    background: url(images/nav_normal.jpg) top repeat;
    border-bottom: 1px solid #999;
    list-style:none;
    }
    
    .leftnavigation li a {
    width: 171px;
    padding: 10px 5px;
    font: bold 10px/1.2 Verdana, Arial, Helvetica, sans-serif;
    text-decoration: none;
    display:block;
    }
    
    .leftnavigation li a:link {color: #392F9D;}
    .leftnavigation li a:visited {color: #66C;}
    .leftnavigation li a:hover,
    .leftnavigation li a:active,
    .leftnavigation li a:focus {
    color:#FFF;
    background-image: url(images/nav_down.jpg);
    }
    

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    http://ALT-Web.com/
    http://Twitter.com/ALTWEB
    http://ALT-Web.blogspot.com

  • How to get the value of the outputtext in javascript and send it to backing bean

    Hi Experts ADF,

    JDev Version 11.1.1.7.0

    I have the following: the value of the outputtext must be treated in javascript and the serverlistener method has the same value. I founded this value returns a string that wshould see the mouseover NIJ.

    Help, please. Thanks in advance.

    < af:column sortProperty = "#{bindings." OrderProposalReadClient.hints.exceptions.name}.

    filterable = "true" sortable = "true".

    headerText = "#{suiviewBundle.EXCEPTIONS} '"

    ID = "c16" >

    < af:outputText value = "#{row.exceptions}" id = "ot32" clientComponent = "true" > "

    < af:clientListener type = "mouseOver".

    method = "customJsFunction" / >

    < af:serverListener type = "mycustomserverEvent".

    Method="#{pageFlowScope.ChangeOrderProposalBean.handleServerEvent}"/ >

    < / af:outputText >

    < / af:column >

    JavaScript

    < af:resource type = "javascript" >

    var customJsFunction = function (event)

    {

    var exceptiondata = AdfPage.PAGE.findComponentByAbsoluteId ('ot32');

    AdfCustomEvent.queue ();

    Returns true;

    }

    < / af:resource >

    BackingBean

    public String handleServerEvent(EC ClientEvent)

    {

    Please let me know how to get the value that javascript code sends here.

    Let's say javascript sends the value of outputtext as "001".

    So, I have to check "001" in my list and return a value that appears on mouseover.

    }

    Kind regards
    Roy

    Hello, Roy.

    To use the value on another component of the user interface, I shows an example:

    -code of the page

    shortDesc = "shortDesc" >

    method = "customJsFunction" / >


    -the javascript code

    var customJsFunction = function (event)

    {

    var exceptiondata = event.getSource ().findComponent("ot32").getValue ();

    AdfCustomEvent.queue (event.getSource (),

    "mycustomserverEvent,"

    {param1:exceptiondata},

    (true);

    Returns true;

    }

    -OutputTextCase11.java

    public void handleServerEvent (EC ClientEvent)

    {

    String param = (String) ce.getParameters () .get ("param1");

    RichOutputText outputText = (RichOutputText) ce.getComponent () .findComponent ("ot1");

    outputText.setShortDesc (param);

    outputText.setValue (param);

    AdfFacesContext.getCurrentInstance () .addPartialTarget (outputText);

    }

    I hope this helps you.

    RFH.

  • How can I get my score for windows Aero, its 4.0 now?

    How can I get my score for windows Aero, its 4.0 now?

    If you have run the assessment and a score of 4.0, you must upgrade your hardware to improve.

    See...

    http://Windows.Microsoft.com/en-GB/Windows7/what-is-the-Windows-experience-index

    .. what States that you must only 3.0 for Aero.

    Tricky

  • How to get IMEI number with phonegap app by using Javascript?

    Hello

    I suffer on this the last 2 days to get the IMEI number in phonegap app by using javascript.

    I found all things related to Phonegap with Android, but I want to get the IMEI number with phonegap app by using javascript/JQuery according to requirement.

    Could you please give me the process step by step to get the IMEI number with phonegap app with javascript/JQuery?

    Thanks in advance.

    Thank you

    Jayaram

    You can use the cordova-plugin-device plugin for a UUID of the device (this api is the same on iOS, Android,...)

    This isn't exactly the same as the IMEI, but it is unique enough to identify the device, while protecting the privacy of the owner of the phone.

    If you need to get the IMEI, then google is your friend. This [1] was the first result when searching for "imei cordova.

    There's a good stack overflow article here [2] which has the disadvantage of using this value and encourage you to consider other ways to identify users, because users cannot trust your application if you ask for this info. Read the accepted answer.

    [1] GitHub - aquto/cordova-plugin-imei

    [2] http://stackoverflow.com/questions/1972381/how-to-get-the-devices-imei-esn-programmaticall y-android

  • How to get images in indesign CS5 with javascript?

    Hello world

    How to get images in indesign CS5 with javascript? I want to delete them.

    Can someone give me some example codes?

    Thank you

    Bridge

    var doc = app.activeDocument;
    var graphics = doc.allGraphics;
    
    for (var i = graphics.length-1; i >= 0; i--) {
         try {
              graphics[i].remove(); // delete only image
              // graphics[i].parent.remove(); // delete image and its containing frame
         }
         catch (err) {}
    }
    

    Note: Tested in CS3, Windows

    I hope this helps.

    Kasyan

  • How to get the Blackberry ID using javascript for Webworks App?

    Hi all

    I have developed a web application using Blackberry webworks SDK and emulator Ripple... Here, I need to get the Blackberry device ID using javascript... Please me... Thanks in advance...

    With respect,

    Marimuthu_P

    HM... There is a sample to get the PIN with javascript.

    https://developer.BlackBerry.com/HTML5/APIs/BlackBerry.identity.html#.UUID

  • JavaScript how to get / change the field (object) TYPE (no access or mandatory)?

    Hello

    I would like to change or at least to get the TYPE of a field/object field

    Reason: I have a function in my script object that needs some things if the given parameter is a text field or button

    {myFunction (Object)}

    If (type is button)...

    ClassName is relative to any use. He always comes = field

    Could someone provide a code please?

    Hello

    This script could help show how to get the type of field.  I'm reasonably show that he originally site of Stefan Cameron, http://forms.stefcameron.com/, but can not find it now.  Basically if you have a 'field' then ui.oneOfChild.className will give you the type of field.

    I don't think you'll have a chance to change the field type.  I think that you need to have all the field types you want on the form and that they are visible when necessary.

    function listAllFields (node)
    {
    If (node.className == 'exclGroup' | node.className == "subform" | node.className == 'subformSet' | node.className == 'region')
    {
    for (var i = 0; i)< node.nodes.length;="">
    {
    If (node.name! = "ErrorIconSubform")
    {
    childNode var = node.nodes.item (i);
    listAllFields (childNode);
    }
    }
    }
    Else if (node.className == "field")
    {
    Switch (node.ui.oneOfChild.className)
    {
    case "button":
    Console.println ("button:" + node.somExpression);
    break;

    case "checkButton":
    If (node.parent.className is "exclGroup")
    Console.println ("RadioButtonList:" + node.somExpression);
    on the other
    Console.println ("checkbox:" + node.somExpression);
    break;

    case "choiceList":
    var oUITypeNode = node.ui.resolveNode ("#choiceList");
    If (oUITypeNode.open is "userControl")
    Console.println ("DropDownList:" + node.somExpression);
    on the other
    Console.println ("ListBox:" + node.somExpression);
    break;
      
    case "dateTimeEdit":
    Console.println ("DateTime:" + node.somExpression);
    break;

    case "imageEdit":
    Console.println ("Image:" + node.somExpression);
    break;

    case "numericEdit":
    Console.println ("digital:" + node.somExpression);
    break;

    case "passwordEdit":
    Console.println ("password:" + node.somExpression);
    break;

    case "textEdit":
    Console.println ("Text:" + node.somExpression);
    break;

    case "signature":
    Console.println ("Signature:" + node.somExpression);
    break;

    case 'barcode ':
    Console.println ("bar code:" + node.somExpression);
    break;

    by default:
    unknown field type
    break;
    }
    }
    }

  • Before the opening of Firefox, I get a window: application JavaScript Exc hand ev: TypeError: This.oRoot.enable is not a function. I have to click ok and then open Firefox

    I click on Firefox to open the browser.
    Browser does not open.
    I get a little window:
    (JavaScript application)
    EXC in hand ev: TypeError: This.oRoot.enable is not a function
    Ok
    I have to click OK and then the browser opens.
    How can I get away with this?
    I use 3.6.11
    Edition 6 created a lot of trouble with printing using Lexmark
    Help, please.

    This problem may be caused by the extension of McAfee Site Advisor

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions of the origin of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • How to connect to an Adobe Javascript(Folder Level Script) SAP Web Service and retrieve the response in a table of the Adobe Javascript/AcroJS. Could you please it explain with an example. I have two required input parameters that must be filled.

    How to connect to an Adobe Javascript(Folder Level Script) SAP Web Service and retrieve the response in a table of the Adobe Javascript/AcroJS. Could you please it explain with an example. I have two required input parameters that must be filled.

    I s generic SOAP example/tutorial on my blog: get a serial number in a form using SOAP - KHKonsulting LLC

    The web service uses only a single parameter, but you should be able to adapt the code to two arguments without problems.

  • How to get number of a character Page?

    Currently I get a character by CreateOutlines Page

    Dim oaPols = oChar.CreateOutlines (False)

    Download oaPols (1) page of the object.

    But sometimes Indesign was the crash by this code: Dim oaPols = oChar.CreateOutlines (False)

    How to get number of a character Page?

    Willi Adelberger wrote:

    Why do you do the contours? It should NEVER be done in InDesign!

    Hey Willi,

    the OP is trying to find a method to get the page name of a character given somewhere on a page or on a spread and use a VB-Script scripting method.

    The False parameter in the method indicates that the character will be duplicated on top of the character as an outline object.
    In the user interface you select a character and press and hold the ALT key when you use the menu command for this.

    Usually we take the object returned after obtaining the information of her by the script.

    But obviously something bad on the side of the OP, because InDesign crashes if this method is used on one of the sample characters. Usually a geometrical object on a page will return the page object as the value of his property in parentPage (ExtendScript).

    I'm not in VB-Script, so here's an excerpt from ExtendScript to get the name of the page in the text of a character block.

    Select a character and run the code snippet:

    // ExtendScript (JavaScript) snippet
    // One single character should be selected:
    
    var myCharacter = app.selection[0];
    var result = myCharacter.parentTextFrames[0].parentPage;
    
    if(result == null)
    {
        alert("Character's text frame is considered on the pasteboard")
    }
    else
    {
        alert("Character's text frame is considered on page: "+result.name)
    };
    

    Now, back to the createOutlines() method.

    It would fail on for example all white space characters and characters that represent a fixed page element.

    It would also fail if the character is in the overset text.

    createOutlines() would be to raise an error, but should not crash InDesign.

    Now go to the OP to the following questions:

    What is the character that you try to use the method with?

    Is there excess in text?

    What is your exact version of InDesign?
    What is the exact version of your Windows operating system?

    Kind regards
    Uwe

  • How to get the text block, given anchor (~ a)

    I need to dynamically position anchored with anchor text blocks (but the relative position will be different for each anchor). If I grep ~ i can get the anchor marker - how to get the text block once I got this marker?

    Thank you

    The marker "anchor" is a character of "simple".

    So you can do the following if you have identified the character (and in this example selected it):

    //Start with an "Anchor Marker" selected:
    var myCharacter = app.selection[0];
    
    if (myCharacter.texts[0].textFrames.length == 1){
    
    var myAnchoredTextFrame = myCharacter.texts[0].textFrames[0];
        //do something with the anchored text frame:
        myAnchoredTextFrame.fillColor = "Yellow";
    
        };
    

    You can set the myCharacter variable differently, if you know the index of the character according to his history of parent.

    Or if you have found the character as part of a search GREP or TEXT by ExtendScript (JavaScript).

    Uwe

  • How to get all the fonts in the paragraph?

    Hi all

    Especially in Indesign Javascript list how to get all the fonts section (without a loop in each character).  For example, I used "Minion Pro" to the first character and all other characters are "Zapf Dingbats" fonts. I use code below to get the paragraph font. But it shows only first typeface. If multiple fonts are used for including the paragraph then I need all the list fonts or result "undefined".

    var myPara = app.selection [0] .paragraphs [0];

    Alert (myPara.appliedFont.FontFamily);

    Thank you and best regards,

    Robert S

    var myPara = app.selection [0] .paragraphs [0];

    Alert (myPara.textStyleRanges.everyItem (.appliedFont));

Maybe you are looking for

  • Firefox not closing completely

    Overview of Windows 8.1Firefox worked fine until this morning. Now I can close the window, but when I want to start it again (by link or desktop) I get a message that Firefox is already running. I use end task in Task Manager.I can then restart Firef

  • Exchange displayed as FYDIBOHF23SPDLT spammers

    Hello The company that I work migrate Exchange email accounts from a local server to Office 365 cloud. As a result, the company all internal senders in e-mail messages sent before the migration are displayed like this: FYDIBOHF23SPDLT. This problem o

  • reformat XP

    I would like to reformat a XP computer which has become unmanageable. It is a Compaq Presario amd sempron. At a small recovery disk. Could someone tell me how to reinstall the operating system? Thank you.

  • I changed my hard drive and would like to reinstall windows 7 ultimate.

    My don't on my Sony Vaio VGN-SZ670N hard drive died and I have no other choice in replaces it.  The new drive has no operating system, and I don't have a recovery CD.  I have my Microsoft for Vista 7 key information as well as my Office Professional

  • BlackBerry Smartphones Alternative browsers

    I was wondering if there are any other browser that we can use. I tried skyfire, but they does not for blackberry... Its a shame I like the web browser. I tried opera mini, but it will not download. Are there any suggestions or web links that I can s