Display Hidden Fields in Survey during Testing Phase

More
5 years 3 months ago #83826 by utsi
utsi created the topic: Display Hidden Fields in Survey during Testing Phase
I'm assuming whenever array filter or array filter exclusion is used a hidden field is created to pass the value between pages. If that is the case, may I know in which function are those hidden fields created so that I can change their 'type' attribute?

What I'm looking for is to show those fields in the question page during the testing phase (i.e. inactive surveys).

Thanks,
Safdar

Please Log in to join the conversation.

More
5 years 3 months ago #83839 by DenisChenu
DenisChenu replied the topic: Display Hidden Fields in Survey during Testing Phase
Hello,

It's in $_SESSION, not in hidden field.

For hidden input, some for "javascript" access, all in qanda.php i think.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 3 months ago - 5 years 3 months ago #83847 by utsi
utsi replied the topic: Display Hidden Fields in Survey during Testing Phase
Thanks for replying. So if I want to echo those $_SESSION variables, I'll have to look for them in the index.php file?

Also could you please tell the format of the session variable used? For ex: $_SESSION[survey_id - group_id - question_id]
Last Edit: 5 years 3 months ago by utsi.

Please Log in to join the conversation.

More
5 years 3 months ago - 5 years 3 months ago #83850 by DenisChenu
DenisChenu replied the topic: Display Hidden Fields in Survey during Testing Phase
Hello,

Test first with:
[code type=php-brief]echo "<pre>".var_export ($_SESSION,true)."</pre>";[/code]

But you can search for:
[code type=php-brief]<input type='hidden'[/code] in classes/expressions/LimeExpressionManager

For debug purpose, you can use some javascript to remove the type='hidden' .

Something like that
$("input[type='hidden']").each(function(){
  var name = $(this).attr('name'); // grab name of original
  var value = $(this).attr('value'); // grab value of original
  /* create new visible input */
  var html = 'hidden'+name+' <input type="text" name="'+name+'" value="'+value+'" />';
  $(this).after(html).remove(); // add new, then remove original input
});

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 5 years 3 months ago by DenisChenu. Reason: code type
The following user(s) said Thank You: utsi

Please Log in to join the conversation.

More
5 years 3 months ago #83866 by TMSWhite
TMSWhite replied the topic: Display Hidden Fields in Survey during Testing Phase

utsi wrote: I'm assuming whenever array filter or array filter exclusion is used a hidden field is created to pass the value between pages. If that is the case, may I know in which function are those hidden fields created so that I can change their 'type' attribute?

What I'm looking for is to show those fields in the question page during the testing phase (i.e. inactive surveys).


Another option is to use templates for this. For example, if you copy the default template, you can replace this section:
<td class="survey-question-help">
	{QUESTIONHELP}
</td>

with this:
<td class="survey-question-help">
	{QUESTIONHELP}
	{if(ACTIVE,"",
		implode("","<table border='1'><tr><th>SGQA</th><th>",implode("</th><th>",self.sgqa),"</th></tr>",
		"<tr><td>RelevanceStatus</td><td>",implode("</td><td>",self.relevanceStatus),"</td></tr>",
		"<tr><td>Value</td><td>",implode("</td><td>",self),"</td></tr></table>"))}
</td>

That will auto-format a table within the Help section that shows (for only inactive surveys), the variable names, relevance status, and current value; and those values will update automatically as you enter data. Since it is using the self variable, it auto-expands for every possible question type so you don't need to hard-code any SGQA values and you can make this a general part of your templates.

Here is what that looks like for the default template:
Attachments:
The following user(s) said Thank You: utsi

Please Log in to join the conversation.

More
5 years 3 months ago #83936 by TMSWhite
TMSWhite replied the topic: Display Hidden Fields in Survey during Testing Phase
utsi-

Looks like {ACTIVE} didn't make it into the 120725 release. 'self' was available as of 120711. So, you may need to wait a week for the next 1.92+ release.

Also, self.SGQA should be all lowercase, not uppercase for SGQA as it displays in these posts.

/Tom
The following user(s) said Thank You: utsi

Please Log in to join the conversation.

More
5 years 3 months ago #83958 by utsi
utsi replied the topic: Display Hidden Fields in Survey during Testing Phase
Oh..no worries. Thanks for taking out time to reply back.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!