Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Array Filter works badly in IE6

Re:Array Filter works badly in IE6 3 years 10 months ago #52586

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2670
  • Thank you received: 322
  • Karma: 121
jessego wrote:
The survey was planned to go live tomorrow. It seems I have to put it off :dry:

In your survey, are both questions on the same page?

If yes, what happens if you put them on different pages? Because if it is true what Shnolle says, and the Array Filter is implemented via PHP for questions that are on different pages, then this could be a solution. Because with PHP there shouldn't occur any browser related problem.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Re:Array Filter works badly in IE6 3 years 9 months ago #52607

  • jessego
  • jessego's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 7
  • Karma: 0
In your survey, are both questions on the same page?

Yes, and different pages' implementation is OK.

So, javascript problem maybe.
The administrator has disabled public write access.

Re:Array Filter works badly in IE6 3 years 9 months ago #52611

  • jessego
  • jessego's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 7
  • Karma: 0
Finally, i've found where the problem is and got a solution.

1.Problem: low-quality javascript code

If the related questions are in the same page, LS implements array filter with javascript.

Click on the checkbox(or radio) triggers the function called checkconditions
function checkconditions(value, name, type)

My question has 26 options, and there are 26X2 if-else blocks in the checkconditions().

The code of if-else block like this:
if ((document.getElementById('java78256X82X324611') != null && document.getElementById('java78256X82X324611').value == 'Y'))
	{
		document.getElementById('javatbd78256X82X325011').style.display='';
		document.getElementById('tbdisp78256X82X325011').value = 'on';
	}
	else
	{
		document.getElementById('javatbd78256X82X325011').style.display='none';
		document.getElementById('tbdisp78256X82X325011').value = 'off';
		$('#javatbd78256X82X325011 input[type=text]').val('');
		$('#javatbd78256X82X325011 input[type=checkbox]').attr('checked', false); 	}

It means when I single click the checkbox, I have to run 52 blocks of code.
And there are 2 jQuery sentences in each else block!!!

jQuery has bad performance in IE6, as u know.

So that's the problem.


2.My solution:
I don't have enough time and I only replace the jQuery code with the normal javascript sentences.

I modified "group.php" (latest version)

Near Line 910, I declare a variable to save the id of the hidden answer(may be a checkbox, text or radio type)
//@author Jesse(jiexi.zha@gmail.com)
$answerid = "answer".$qbase.$fansrows['title'];

Near Line 940
// This line resets the text fields in the hidden row
$appendj .= "\t\t$('#$tbody input[type=text]').val('');\n";
// This line resets any radio group in the hidden row
$appendj .= "\t\t$('#$tbody input[type=checkbox]').attr('checked', false); ";

changed to
// Modified By Jesse (jiexi.zha@gmail.com)
// Abandon the jQuery Implementation. Because IE6 sucks.
$appendj .= "\t\t inputtype = document.getElementById('$answerid').type;\n";
// This line resets the text fields in the hidden row
// $appendj .= "\t\t$('#$tbody input[type=text]').val('');";
$appendj .= "\t\tif(inputtype == 'text') document.getElementById('$answerid').value = '';\n";
// This line resets any radio group in the hidden row
// $appendj .= "\t\t$('#$tbody input[type=checkbox]').attr('checked', false); ";
$appendj .= "\t\tdocument.getElementById('$answerid').checked = false;\n";

Near Line 963, 1028, 1060
// This line resets the text fields in the hidden row
$appendj .= "\t\t$('#$tbody input[type=text]').val('');";
// This line resets any radio group in the hidden row
$appendj .= "\t\t$('#$tbody input[type=radio]').attr('checked', false); ";

changed to
// Modified By Jesse (jiexi.zha@gmail.com)
// Abandon the jQuery Implementation. Because IE6 sucks.
$appendj .= "\t\t inputtype = document.getElementById('$answerid').type;\n";
// This line resets the text fields in the hidden row
// $appendj .= "\t\t$('#$tbody input[type=text]').val('');";
$appendj .= "\t\tif(inputtype == 'text') document.getElementById('$answerid').value = '';\n";
// This line resets any radio group in the hidden row
// $appendj .= "\t\t$('#$tbody input[type=radio]').attr('checked', false); ";
$appendj .= "\t\tdocument.getElementById('$answerid').checked = false;\n";

That really improve the performance in IE6.
I hope someone would rewrite the javascript function and give us a better solution.

holch and Shnoulle, thanks a lot!
Last Edit: 3 years 9 months ago by jessego.
The administrator has disabled public write access.

Re:Array Filter works badly in IE6 3 years 9 months ago #52621

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6331
  • Thank you received: 817
  • Karma: 243
jessego wrote:
That really improve the performance in IE6.
I hope someone would rewrite the javascript function and give us a better solution.
![/quote]

I think it's great if you can put the patch on bug report system. If you can , do the patch for limesurvey-dev version.

bug report: bugs.limesurvey.org/
Dev version : docs.limesurvey.org/tiki-index.php?page=...meSurvey+development

It can be great :)


PS: holch: alinks is a pure text based on lynx . No javascript at all , and no CSS too. Then you can't do something.
The administrator has disabled public write access.

Re:Array Filter works badly in IE6 3 years 9 months ago #52627

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
Thanks for having such a detailed look at it. To forward your findings to our developer, please open a ticket at our bugtracker as Shnoulle has suggested.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re:Array Filter works badly in IE6 3 years 9 months ago #52629

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2670
  • Thank you received: 322
  • Karma: 121
jessego wrote:
holch and Shnoulle, thanks a lot!

No problem! And as Shnoulle and Mazi said: it would be great if you could submit your improvements, so that it could be implemented in Limesurvey. This would help others as well. And you won't have to bother when it comes to updates of Limesurvey.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Re:Array Filter works badly in IE6 3 years 9 months ago #52633

  • jessego
  • jessego's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 7
  • Karma: 0
I think it's great if you can put the patch on bug report system.

ok, i'll do that :cheer:
The administrator has disabled public write access.

Re:Array Filter works badly in IE6 3 years 9 months ago #52643

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
Great, please post the link here afterwards.

Thanks!

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.507 seconds
Donation Image