×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Apr 2013
    Posts
    25

    Question undefined field is found in my trivia app

    Hi!
    i'm developing a trivia web app using web app simulator 2.3.0. I have added five questions by modifying the javascript contents.But when I run it I get 5 options as answers in which one is undefined which I have not added. Kindly help me resolve this issue.
    Ruth
    Last edited by Jruth; 2013-04-20 at 08:27.

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,560

    Re: undefined field is found in my trivia app

    Hard to help if you don't show/post your code.

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    10

    Re: undefined field is found in my trivia app

    Please kindly post your code so that we can review what's wrong with it You can use [CODE] tag to prettify your code snippet.
    Code:
    function myBuggedFunction() {
        return "What Bug?";
    };

  4. #4
    Registered User
    Join Date
    Apr 2013
    Posts
    25

    Re: undefined field is found in my trivia app

    Quote Originally Posted by petrib View Post
    Hard to help if you don't show/post your code.
    Thanks for the help
    <code> var category7 = Trivia.createCategory('Miracles');
    category7.addQuestion("When Jesus raised up the daughter of Jairus He said to her ............?", "Talitha Cumi!|Ephatha|Nothing|Eloi Eloi Lama Sabachtani".split("|"), 1);
    category7.addQuestion("When the Israelites were chased by the Egyptians behind and they faced the Red Sea before them GOD ........... ?", "Made the people to fly and reach the other side|Divided the Red Sea|Left His people|Did nothing".split("|"), 2);
    category7.addQuestion("A man born with no sight called on Jesus and became well. What did he cry out to Jesus?", "Forgive me, Jesus, Son of David|Jesus, Son, of David Heal me|Jesus, Son of David, have mercy on me|Jesus help me I cannot see".split("|"), 3);
    category7.addQuestion("Jesus had compassion on a young dead man who was the son of a widow in Nain.What did He do for her?", "Said that GOD will raise all who are dead at a particular time|Cried with the mother and went away|Gave her some money to take care of her self|Raised back the son to life".split("|"), 4);
    <code>
    Also I included 7 categories but only 3 are displayed while i run my app in emulator.

  5. #5
    Registered User
    Join Date
    Apr 2013
    Posts
    25

    Re: undefined field is found in my trivia app

    Quote Originally Posted by kemasdimas View Post
    Please kindly post your code so that we can review what's wrong with it You can use [CODE] tag to prettify your code snippet.
    Code:
    function myBuggedFunction() {
        return "What Bug?";
    };
    <code>var category7 = Trivia.createCategory('Miracles');
    category7.addQuestion("When Jesus raised up the daughter of Jairus He said to her ............?", "Talitha Cumi!|Ephatha|Nothing|Eloi Eloi Lama Sabachtani".split("|"), 1);
    category7.addQuestion("When the Israelites were chased by the Egyptians behind and they faced the Red Sea before them GOD ........... ?", "Made the people to fly and reach the other side|Divided the Red Sea|Left His people|Did nothing".split("|"), 2);
    category7.addQuestion("A man born with no sight called on Jesus and became well. What did he cry out to Jesus?", "Forgive me, Jesus, Son of David|Jesus, Son, of David Heal me|Jesus, Son of David, have mercy on me|Jesus help me I cannot see".split("|"), 3);
    category7.addQuestion("Jesus had compassion on a young dead man who was the son of a widow in Nain.What did He do for her?", "Said that GOD will raise all who are dead at a particular time|Cried with the mother and went away|Gave her some money to take care of her self|Raised back the son to life".split("|"), 4);</code>
    I created7 categories but only 3 are visible.

  6. #6
    Registered User
    Join Date
    Mar 2013
    Location
    United Kingdom
    Posts
    161

    Re: undefined field is found in my trivia app

    Code:
     var category7 = Trivia.createCategory('Miracles');
    category7.addQuestion("When Jesus raised up the daughter of Jairus He said to her ............?", "Talitha Cumi!|Ephatha|Nothing|Eloi Eloi Lama Sabachtani".split("|"), 1);
    category7.addQuestion("When the Israelites were chased by the Egyptians behind and they faced the Red Sea before them GOD ........... ?", "Made the people to fly and reach the other side|Divided the Red Sea|Left His people|Did nothing".split("|"), 2);
    category7.addQuestion("A man born with no sight called on Jesus and became well. What did he cry out to Jesus?", "Forgive me, Jesus, Son of David|Jesus, Son, of David Heal me|Jesus, Son of David, have mercy on me|Jesus help me I cannot see".split("|"), 3);
    category7.addQuestion("Jesus had compassion on a young dead man who was the son of a widow in Nain.What did He do for her?", "Said that GOD will raise all who are dead at a particular time|Cried with the mother and went away|Gave her some money to take care of her self|Raised back the son to life".split("|"), 4);
    That should work, you forgot the trailing / in your tag. You also need to use [] instead of <> to wrap the tag.

  7. #7
    Registered User
    Join Date
    Mar 2013
    Location
    United Kingdom
    Posts
    161

    Re: undefined field is found in my trivia app

    It seems to me that an exception is happening in the addQuestion() method. Have you tried running your application in debug mode to isolate which line this is happening on?

  8. #8
    Regular Contributor
    Join Date
    Jun 2010
    Posts
    161

    Re: undefined field is found in my trivia app

    I have not tested it, but if the "correct answer ID" is related to the array, you have to know that the index starts at 0. So when you add the question
    Code:
    category7.addQuestion("When the Israelites were chased by the Egyptians behind and they faced the Red Sea before them GOD ........... ?", "Made the people to fly and reach the other side|Divided the Red Sea|Left His people|Did nothing".split("|"), 2);
    The correct answer is "Divided the Red Sea", the second answer given, at index 1, therefor you need to add 1 ad the end.
    I guess the error appears when the correct answer is 3. Since there is no array index 3 (3 answers = 0,1,2), it will give the error.

  9. #9
    Registered User
    Join Date
    Apr 2013
    Posts
    25

    Re: undefined field is found in my trivia app

    thankyou problem is solved

  10. #10
    Regular Contributor
    Join Date
    Jun 2010
    Posts
    161

    Re: undefined field is found in my trivia app

    And what was the solution? Maybe someone else will have the same problem.

  11. #11
    Registered User
    Join Date
    Apr 2013
    Posts
    25

    Re: undefined field is found in my trivia app

    i need really urgent help I have finished coding my app how do i publish it

  12. #12
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,560

    Re: undefined field is found in my trivia app

    Quote Originally Posted by Jruth View Post
    i need really urgent help I have finished coding my app how do i publish it
    https://www.developer.nokia.com/Dist...idelines.xhtml

Similar Threads

  1. WRT GPS undefined
    By gurmukh in forum Symbian
    Replies: 5
    Last Post: 2010-03-15, 10:44
  2. Form field--date and time in same field
    By wailel in forum Symbian
    Replies: 0
    Last Post: 2010-02-13, 02:46
  3. Replies: 3
    Last Post: 2009-07-02, 12:44
  4. How to Build a field test sw like "field test"?
    By felong in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2006-04-24, 07:45
  5. ALERT: Duplicate field found
    By multamedio in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2005-06-28, 08:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×