Getting items in dropdown box from file

mlapl1
mlapl1 Community Member Posts: 350 ♪ Opening Act ♪
Hello everyone

I wonder if anyone knows how to do this.

I would like to retrieve the items in a dropdown box from a file, not from the mysterious innards of Lectora (and not the Lectora XML .awt file). Is there a way of doing this (JS is ok - although I usually try to avoid that).

Thanks and have a nice Sunday.

Andrew

Comments

  • klaatu
    klaatu Community Member Posts: 986 ☆ Roadie ☆
    Hi, Andrew. I'm not sure I understand correctly. Are looking to access the option values in a dropdown from a published lectora lesson or prior? What do you mean 'from a file'? Do you mean something like accessing the options from a published .html or .js file?

    Are you looking to access the values from another application?
  • jasonadal
    jasonadal Community Member Posts: 450 ♪ Opening Act ♪
    Hi Andrew - Depending your goals, this post started by Stan might be helpful. I have not gotten around to trying the solutions offered, so I don't know if/what solution works for my goals.

    In summary, my goal was to create "conditional" drop lists so that a selection in one drop list defined the items in a subsequent drop list. Math's solution came close, but was restricted to the number of choices set in Lectora.

    Populate a drop-down list with JavaScript
  • mlapl1
    mlapl1 Community Member Posts: 350 ♪ Opening Act ♪
    Thank you both for your suggestions.

    What I would like to do is to populate a dropdown box with information stored in  an external file linked to the title.

    I guess I could write the whole thing in JS but would prefer to stick to the Lectora dropdown box if possible (but I suspect it is not possible). I am in the process of creating some Lectora templates which would be compiled only once but would run many different lessons by importing different data from embedded JS files (at this stage - soon will draw on a mysql database). One problem I have is that the number of questions will vary from lesson to lesson and at the moment I have to set an upper limit (e.g. 50 questions) and produce some kind of error message if there are fewer than 50 questions e.g. if there are only 30 questions but the student requests lesson 35 s/he would receive some kind of message saying that this question does not exist (or whatever).

    Hope this makes sense.

     

     

     

     
  • klaatu
    klaatu Community Member Posts: 986 ☆ Roadie ☆
    Search my posts, I already explained how to do this. Yes, JavaScript is required.
  • mlapl1
    mlapl1 Community Member Posts: 350 ♪ Opening Act ♪
    Thank you Darrel - I will take a look.