I would like to keep track of which employees have taken the created Tutorial (xPlain)
I would like to pass the parameter in the url
something like
example.html/?empno=12345
I would capture the empno in the xplain, possible pass it to chained explains. Finally when completed I will send an API to update database
Has anyone attempted this yet?
Thank you for any help you can give me on this!
URL Parameter
Moderators: Alexander Halser, Tim Green
-
- Posts: 14
- Joined: Tue Jul 23, 2019 2:22 am
Re: URL Parameter
Figured out how to get url parameter - Here is how to do it in case you are trying to do it
in custom scripts --
//*** Got this function from https://css-tricks.com/snippets/javascr ... variables/ ***
function getQuery(name){
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search))
return decodeURIComponent(name[1]);
}
on a slide put a textbox - rename it text1 and put text like "Empno"
for text1 goto Link & Interaction -> Execute Script (radio button)
enter -> xplain.set("#text1", {innerHTML:getQuery("empno")}, 0);
when you click text1 you will get "undefined" in text1 (we have not defined empno yet)
Publish and open in browser - add -> ?empno=12345 <- to end of url (then refresh)
example: N:/HelpExplain/GetEmpno.html?empno=12345
now when you hit text1 empno 12345 will show up
notice that xplain.set allows you to put Java Function in it! Pretty cool
in custom scripts --
//*** Got this function from https://css-tricks.com/snippets/javascr ... variables/ ***
function getQuery(name){
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search))
return decodeURIComponent(name[1]);
}
on a slide put a textbox - rename it text1 and put text like "Empno"
for text1 goto Link & Interaction -> Execute Script (radio button)
enter -> xplain.set("#text1", {innerHTML:getQuery("empno")}, 0);
when you click text1 you will get "undefined" in text1 (we have not defined empno yet)
Publish and open in browser - add -> ?empno=12345 <- to end of url (then refresh)
example: N:/HelpExplain/GetEmpno.html?empno=12345
now when you hit text1 empno 12345 will show up
notice that xplain.set allows you to put Java Function in it! Pretty cool
- Tim Green
- Site Admin
- Posts: 23189
- Joined: Mon Jun 24, 2002 9:11 am
- Location: Bruehl, Germany
- Contact:
Re: URL Parameter
Hi Terry,
Nice. I haven't tested out your regex in detail, but you need to make sure that only valid data can get through, to protect yourself against cross-site scripting attacks.
Nice. I haven't tested out your regex in detail, but you need to make sure that only valid data can get through, to protect yourself against cross-site scripting attacks.
Regards,
Tim (EC Software Documentation & User Support)
Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Tim (EC Software Documentation & User Support)
Private support:
Please do not email or PM me with private support requests -- post to the forum directly.