Welcome, Guest
Username: Password: Remember me

TOPIC: Javascript popover on a question?

Javascript popover on a question? 3 years 6 months ago #59291

  • HCI_Guy
  • HCI_Guy's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 20
  • Karma: 0
Hello!
  • I have a survey set up in LimeSurvey.
  • I know how to create a jQuery-based popover.
  • I see that LimeSurvey uses jQuery.

The issue here is that I cannot get the popover to work within a question. I have done the "Show Source" dance and put Javascript calls there. I have edited the template's CSS file as needed.

I have no idea where to go with this and am wondering if:
  1. This is possible.
  2. Anyone here has done this or can point me in some direction.

Thank you.
The administrator has disabled public write access.

Re: Javascript popover on a question? 3 years 6 months ago #59310

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4272
  • Thank you received: 806
  • Karma: 369
Can you get a simple JavaScript alert to work?

Are there any JavaScript errors?

Have you set the XSS filter to "No" in gobal settings?
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Javascript popover on a question? 3 years 6 months ago #59351

  • HCI_Guy
  • HCI_Guy's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 20
  • Karma: 0
In order:

Yes (per the example; this was a good thing to include in the samples!);

No;

Yes.
The administrator has disabled public write access.

Re: Javascript popover on a question? 3 years 6 months ago #59352

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4272
  • Thank you received: 806
  • Karma: 369
I would imagine that the pop-over is created with a jQuery plugin. Have you included the plugin file in the <head> element of startpage.pstpl?

Can you activate a sample survey for us to see?
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Javascript popover on a question? 3 years 6 months ago #59369

  • HCI_Guy
  • HCI_Guy's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 20
  • Karma: 0
Good catch; I didn't know that startpage.pstpl was where this went.

The item that is giving me all sorts of headaches is a text passage with a jQuery-based div overlay.

This is the text outside of LimeSurvey. Note the positioning and function of the overlay.

Here is a link to the text in situ.

It now seems that there is an issue between template.js and my popOver.js file. The progressbar isn't loading, and variables found in the popOver.js file aren't showing up. I'm at a loss.

I've made significant progress on all fronts other than that of LimeSurvey--to be fair, I've also spent the least amount of time in LimeSurvey.
tpartner wrote:
I would imagine that the pop-over is created with a jQuery plugin. Have you included the plugin file in the <head> element of startpage.pstpl?

Can you activate a sample survey for us to see?
Last Edit: 3 years 6 months ago by HCI_Guy.
The administrator has disabled public write access.

Re: Javascript popover on a question? 3 years 6 months ago #59370

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4272
  • Thank you received: 806
  • Karma: 369
The progressbar isn't loading...
Remove the jQuery file being loaded in your startpage.pstpl - it is already loaded by the core code and may conflict.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 3 years 6 months ago by tpartner.
The administrator has disabled public write access.

Re: Javascript popover on a question? 3 years 6 months ago #59376

  • HCI_Guy
  • HCI_Guy's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 20
  • Karma: 0
Your responses have been exceptionally helpful! I've pulled out the reference and everything is now loading. So good news there.

I've also added the onload window event, as is in my sample HTML code. Oops. Bad programmer (me).

I have a more fundamental problem that I would hope I could impose on you slightly to resolve. None of my prior coding experience is Web 2.0, AJAX,JavaScript, what have you, so this is very new to me. My prior experience has been server-side DOM rather than shared- or client-load.

I feel I'm missing something very basic here ... when the user clicks "Submit," I don't want the form to cause any change in the background page. Where I have an alertbox now, I plan to insert these values into a hidden text field (I saw some examples out on the LimeSurvey documentation pages). I think I'll end up wanting code like the "Back to Top" <div> on this very forum. I see that document.ready was used here rather than document.onload. I suspect document.ready is the better trigger.

Again, I feel this is pretty basic (and not within the scope of LimeSurvey support, per se), but I'm somewhat stumped after spending a few days going from knowing nothing about CSS <div>s and knowing nothing about jQuery/Javascript to where I am not.

Any pointers?
Last Edit: 3 years 6 months ago by HCI_Guy.
The administrator has disabled public write access.

Re: Javascript popover on a question? 3 years 6 months ago #59379

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4272
  • Thank you received: 806
  • Karma: 369
I don't want the form to cause any change in the background page...
If you have an extra form on the page, try changing its submit button from type="submit" to type="button". That way it shouldn't submit the limesurvey form.
I see that document.ready was used here...
More info here.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 3 years 6 months ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: HCI_Guy

Re: Javascript popover on a question? 3 years 6 months ago #59382

  • HCI_Guy
  • HCI_Guy's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 20
  • Karma: 0
Wow.

I wanted to come back and say a couple things:
  1. THANK YOU for your time and effort here, it works as desired now (though on reflection and study, I'm not moving to document.ready() for timing reasons).
  2. The support given here, and offered by LimeSurvey, is far above and beyond SurveyMonkey (who immediately told me that this couldn't be done) and SurveyGizmo (who, after waiting six days, told me that they could connect me with a developer if I had a rather significant amount of money to spend on this).
(Mods: feel free to remove the vendor names above. I don't mean to be inflammatory, but these seem to be the key players in web-based survey packages: LimeSurvey, SurveyMonkey, and SurveyGizmo.)

Thanks!
Last Edit: 3 years 6 months ago by HCI_Guy.
The administrator has disabled public write access.

Re: Javascript popover on a question? 3 years 6 months ago #59389

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6451
  • Thank you received: 844
  • Karma: 249
Hello HCI_Guy ,
You're welcome!

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.

And if i have some memory, Tony accept beer :)
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.124 seconds
Donation Image