March 28, 2020 at 9:49 am #441333
Passing HTML extension value”demo1″ to lectora variable “bar_slider1”
I have been trying to pass a slider value to my lectora course. I have been through this and many other forums only to find explanations that fall short of actual giving me the answer. They show code that you should modify never show you what you actually need. So could someone please help me. I have attached the html content being displayed for you to view. I require the slider value which i take is “demo1” and i want that value passing to Lectora variable “var_slider1”. How do i do it?
Attachments:March 28, 2020 at 1:03 pm #441354
What you actually need:
This post has received 1 vote up.March 29, 2020 at 7:36 pm #441380
- A variable in Lectora
The variable needs a name, e.g. “slider1”
- Awareness that Lectora renames variables during publication
A variable called “slider1” will be called “Varslider1” after publication, a variable named “var_slider1” in Lectora will be called “Varvar_slider1”
- Slight modification of your current script
You have a function that inserts the slider value into that “demo1” span. The code to put the value into that Lectora variable would be “Varslider1.set(this.value);” (depending on the name of course)
- You need to use that variable in a Lectora action otherwise it won’t exist
Joe WielochModerator59 pts@wheels
As Tim says use Varname.set(
) to set the variable and Varname.getValue() to get the current value.
Math NotermansMember125 pts@mnotermans5114
Or use jQueryUI..lots of UI samples like a slider are easily to implement in Lectora.March 30, 2020 at 1:07 am #441388
OK thanks for your messages, so i have added an action to a submit button in lectora.
I get an error message after pressing the submit button “[OnMClkRunJS] ReferenceError: Varname is not defined”
What should “Varname” be?March 30, 2020 at 7:50 am #441401
I know you’re already on your way in this direction, however, in the future you might want to consider a CSS slider. Pretty easy to work with. The attached works fine with the wonky type of responsive programming this program outputs, however, I did not alter the JS for “seamless play” so if you want tot use it you’ll have to target the parents – just don’t use seamless. I posted this a while back and updated it with the newest minimized Jquery.
Just another option, there are numerous. Math’s suggestion is a good way to go as well.
Attachments:March 30, 2020 at 7:56 am #441404
One other thing about the CSS slider above. The CSS is old but works perfectly. It could use updating (I’m too lazy) as most of it not all the vendor prefixes aren’t necessary anymore.March 30, 2020 at 9:47 am #441424
Could i have the lectora editable file so that i can see how this works.March 30, 2020 at 5:16 pm #441471
Sorry, I thought I included it in the zip. Here is the awt and some of the other support files in case you need them.
Attachments:March 31, 2020 at 12:28 am #441477
Thanks that works well. All i need to know now is out to pass the slider value to a variable in lectora.March 31, 2020 at 3:05 am #441480
I’ve put the code from above into Darrels sample.
Attachments:March 31, 2020 at 9:43 am #441505
It works fine on its own. copy page and add assets and i get error, see attached
Attachments:March 31, 2020 at 3:34 pm #441537
The sample requires jQuery. It should work when you also copy the HTML extensions on title level “jquery” and “css”.April 1, 2020 at 12:56 am #441545
I had already done that please see attached.April 1, 2020 at 12:57 am #441552
Please see attached
- A variable in Lectora
You must be logged in to reply to this topic.