Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:
  • Seite:
  • 1
  • 2

THEMA: time_limit_disable_next and navigationdelay for individual questions

time_limit_disable_next and navigationdelay for individual questions 1 Jahr 7 Monate her #93538

  • robstone
  • robstones Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Dank erhalten: 1
  • Karma: 0
I see how navigationdelay is set for the whole survey and used in the frontend_helper:surveymover function to create the buttons,
but I see there is a question attribute called time_line_diable_next (and prev) which is used in qanda_helper:return_timer_script
but im not sure how !

what i am trying to achieve is the equivalent of navigation delay feature but with per question timeouts (or use
navigation delay if null) so there'd be choice....

1) 0
2) lime_surveys:sid:navigationdelay
3) lime_question_attributes:qid:time_line_diasble_next

is this sensible/achievable with a some easy tweaks (looks like i should amend surveymover) ?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

time_limit_disable_next and navigationdelay for individual questions 1 Jahr 7 Monate her #93811

  • robstone
  • robstones Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Dank erhalten: 1
  • Karma: 0
I managed to do what i anted using javascript and calling the LS navigation_countdown function
after disabling the next button, All works well. Only pain is I have to hard code the time into
each question , cant get it from LS anywhere (eg a question attribute via a {USER_DATA} keyword
or such like, but i guess these are disabled for security)
Der Administrator hat öffentliche Schreibrechte deaktiviert.

time_limit_disable_next and navigationdelay for individual questions 1 Jahr 6 Monate her #94915

  • rasheed
  • rasheeds Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 35
  • Dank erhalten: 2
  • Karma: 0
Could you please share the code you used for that ?

Thank you
Der Administrator hat öffentliche Schreibrechte deaktiviert.

time_limit_disable_next and navigationdelay for individual questions 1 Jahr 6 Monate her #95234

  • robstone
  • robstones Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Dank erhalten: 1
  • Karma: 0
sure

in the help section of the question is this code (where 10 means 10 seconds - put what you like)
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
       /* See /uploads/templates/teds/template.js  */
       rfs_nav_delay(10); 
	});
</script>
 

the script is in the template.js uses 2 functions. we only enable the next button
when the countdown has timed out *and* an option has been selected.

comments / tweaks / tidying up / welcome

 
/*
 * The function rfs_nav_delay waits n seconds before enabling the next key 
 * 
 * uses same methods as normal LS. For including per question,
 */
 
function rfs_nav_delay(n)
{
	$(document).ready(function() {
		$('#movenextbtn').attr('disabled', 'disabled'); 
		$('#movenextbtn').attr('aria-disabled', true);
		$('#movenextbtn').button("disable");
		navigator_countdown(n); 
		//navigator_countdown(1); 
 
 
		//$('#movenextbtn').hide();
		//Show the next button when a radio is clicked
		// use rfs_click_required requires so doenst break if rfs_nav is not called.
		$(window).data('rfs_click_required',1);
		$('input.radio').click(function(){
			$(window).data('rfs_click_required', null);
			if (!$(window).data('countdown')) {
				$('#movenextbtn').attr('aria-disabled', false);
				$('#movenextbtn').button("option", "disabled", false);
			};
		});
	});
}
 
// RFS  addded the rfs_clicked state to check if a buton has been clicked.
// logic is a bit about face so that suvreys that don't set it are not affetced
function navigator_countdown_end()
{
	if (!$(window).data('rfs_click_required')) {
		navigator_countdown_btn().each(function(i, e)
		{
			e.value = $(e).data('text');
			$(e).button("option", "disabled", false);
			$(e).attr('aria-disabled','false');
		});
		$(window).data('countdown', null);
	}
}
 
Letzte Änderung: 1 Jahr 6 Monate her von robstone.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: rasheed

time_limit_disable_next and navigationdelay for individual questions 1 Jahr 6 Monate her #95247

  • rasheed
  • rasheeds Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 35
  • Dank erhalten: 2
  • Karma: 0
Thank you very much.

However, i see the countdown on the previous boutton as well. Is if possible to remove it from there ?

Thank you :)
Der Administrator hat öffentliche Schreibrechte deaktiviert.

time_limit_disable_next and navigationdelay for individual questions 1 Jahr 2 Monate her #98606

  • peehoo
  • peehoos Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 19
  • Karma: 0
robstone schrieb:
sure

in the help section of the question is this code (where 10 means 10 seconds - put what you like)
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
       /* See /uploads/templates/teds/template.js  */
       rfs_nav_delay(10); 
	});
</script>
 

the script is in the template.js uses 2 functions. we only enable the next button
when the countdown has timed out *and* an option has been selected.

comments / tweaks / tidying up / welcome

 
/*
 * The function rfs_nav_delay waits n seconds before enabling the next key 
 * 
 * uses same methods as normal LS. For including per question,
 */
 
function rfs_nav_delay(n)
{
	$(document).ready(function() {
		$('#movenextbtn').attr('disabled', 'disabled'); 
		$('#movenextbtn').attr('aria-disabled', true);
		$('#movenextbtn').button("disable");
		navigator_countdown(n); 
		//navigator_countdown(1); 
 
 
		//$('#movenextbtn').hide();
		//Show the next button when a radio is clicked
		// use rfs_click_required requires so doenst break if rfs_nav is not called.
		$(window).data('rfs_click_required',1);
		$('input.radio').click(function(){
			$(window).data('rfs_click_required', null);
			if (!$(window).data('countdown')) {
				$('#movenextbtn').attr('aria-disabled', false);
				$('#movenextbtn').button("option", "disabled", false);
			};
		});
	});
}
 
// RFS  addded the rfs_clicked state to check if a buton has been clicked.
// logic is a bit about face so that suvreys that don't set it are not affetced
function navigator_countdown_end()
{
	if (!$(window).data('rfs_click_required')) {
		navigator_countdown_btn().each(function(i, e)
		{
			e.value = $(e).data('text');
			$(e).button("option", "disabled", false);
			$(e).attr('aria-disabled','false');
		});
		$(window).data('countdown', null);
	}
}
 

Hi!

I tried to dot this... Can you give me more specific instructions please :ohmy:.

I paste your code to the help section but it was visible when looking questions??
Der Administrator hat öffentliche Schreibrechte deaktiviert.

time_limit_disable_next and navigationdelay for individual questions 1 Jahr 2 Monate her #98609

  • rasheed
  • rasheeds Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 35
  • Dank erhalten: 2
  • Karma: 0
You need to place it in the source code of the help section (HTML).

Hope this helps.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: peehoo

time_limit_disable_next and navigationdelay for individual questions 1 Jahr 2 Monate her #98612

  • peehoo
  • peehoos Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 19
  • Karma: 0
Sorry... How am I able to see each questions source code?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

time_limit_disable_next and navigationdelay for individual questions 1 Jahr 2 Monate her #98613

  • rasheed
  • rasheeds Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 35
  • Dank erhalten: 2
  • Karma: 0
Click on the 3rd boutton from left: Source
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: peehoo

time_limit_disable_next and navigationdelay for individual questions 1 Jahr 2 Monate her #98614

  • peehoo
  • peehoos Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 19
  • Karma: 0
Hi!

I just found it but... do I have to do something more? like:

"the script is in the template.js uses 2 functions. we only enable the next button
when the countdown has timed out *and* an option has been selected."

Do I have to modify template.js file? And if yes... where I put this code?

Sorry I'm noob!! :whistle:
Letzte Änderung: 1 Jahr 2 Monate her von peehoo.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
  • Seite:
  • 1
  • 2
Moderatoren: ITEd
Ladezeit der Seite: 0.154 Sekunden
Donation Image