Welcome, Guest
Username: Password: Remember me

TOPIC: hide a cell in array dual scale

hide a cell in array dual scale 7 months 2 weeks ago #104194

  • MikeConom
  • MikeConom's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 1
  • Karma: 0
Good evening

I am trying to hide a cell in array dual scale with following script and to replace it by a numeric cell
but something is rong
var qID = {QID};
var select = '<div id="insertedNo"> \
    <input type="numeric-item text-item  numberonly" title="" name="no" /> \
    </div>';
 
$('#question'+qID+' .answer_cell_1_001' input.radio').hide();
$('#question'+qID+' .answer_cell_1_001').append(select);
The administrator has disabled public write access.

hide a cell in array dual scale 7 months 2 weeks ago #104198

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4185
  • Thank you received: 785
  • Karma: 359
To return the question ID for a dual scale array you need to use "{self.qid}" (no idea why). And you had a couple of syntax errors.

Try this:

<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function() {
		var qID = {self.qid};
		var newSelect = '<div id="insertedNo"> \
    					<input type="numeric-item text-item  numberonly" title="" name="no" /> \
				</div>';
 
		$('#question'+qID+' .answer_cell_1_001 input.radio').hide();
		$('#question'+qID+' .answer_cell_1_001').append(newSelect);
	});
 
</script>

.
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: 7 months 2 weeks ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: MikeConom

hide a cell in array dual scale 7 months 2 weeks ago #104203

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6318
  • Thank you received: 811
  • Karma: 242
tpartner wrote:
To return the question ID for a dual scale array you need to use "{self.qid}" (no idea why).
Really strange this issue, {QID} must be allways replaced by the question QID (if use in a question). There are a bug here :).

MikeConom, please: can you report this bug to our bug tracker ?
Last Edit: 7 months 2 weeks ago by DenisChenu. Reason: pleae => please
The administrator has disabled public write access.

hide a cell in array dual scale 7 months 2 weeks ago #104204

  • MikeConom
  • MikeConom's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 1
  • Karma: 0
very clever and with full mystery "{self.qid}"

ok Denis. ill report the bug

Tony thanks
this script working for the col and not for the cell.
how can i hide only the cell?
The administrator has disabled public write access.
The following user(s) said Thank You: DenisChenu

hide a cell in array dual scale 7 months 2 weeks ago #104212

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4185
  • Thank you received: 785
  • Karma: 359
Sorry, I don't understand the question.
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.

hide a cell in array dual scale 7 months 2 weeks ago #104228

  • MikeConom
  • MikeConom's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 1
  • Karma: 0
Tony
Sorry for a short informations

i have attach an icon sample. When i execute the scripr
<script type="text/javascript" charset="utf-8">
 $(document).ready(function() {
   var qID = {self.qid};
   var newSelect1 = '<div id="insertedNo1"> \
      <input type="numeric-item text-item numberonly" title="" name="no1" /> \
      </div>';
   var newSelect2 = '<div id="insertedNo2"> \
      <input type="numeric-item text-item numberonly" title="" name="no2" /> \
      </div>';
 $('#question'+qID+' .answer_cell_1_001 input.radio').hide();
 $('#question'+qID+' .answer_cell_2_001 input.radio').hide();
 $('#question'+qID+' .answer_cell_1_001').append(newSelect1);
 $('#question'+qID+' .answer_cell_2_001').append(newSelect2);
});
</script>
the first col is hidden and also with my code and the fifth col.
if i want to hide only the first left cell as my red mark, is it possible?
Thanks
Attachments:
The administrator has disabled public write access.

hide a cell in array dual scale 7 months 2 weeks ago #104230

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4185
  • Thank you received: 785
  • Karma: 359
Try this:

<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
		var qID = {self.qid};
		var newSelect1 = '<div id="insertedNo1"> \
					<input type="numeric-item text-item numberonly" title="" name="no1" /> \
				</div>';
		var newSelect2 = '<div id="insertedNo2"> \
					<input type="numeric-item text-item numberonly" title="" name="no2" /> \
				</div>';
		$('#question'+qID+' .answer_cell_1_001:first input.radio').hide();
		$('#question'+qID+' .answer_cell_2_001 input.radio').hide();
		$('#question'+qID+' .answer_cell_1_001:first').append(newSelect1);
		$('#question'+qID+' .answer_cell_2_001').append(newSelect2);
	});
</script>

.
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: 7 months 2 weeks ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: MikeConom

hide a cell in array dual scale 7 months 2 weeks ago #104235

  • MikeConom
  • MikeConom's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 1
  • Karma: 0
is it the same if i use the following?
$('#question'+qID+' .answer_cell_1_001:eq(1) input.radio').hide();
 $('#question'+qID+' .answer_cell_2_001 input.radio').hide();
 $('#question'+qID+' .answer_cell_1_001:eq(1)').append(newSelect1);
 $('#question'+qID+' .answer_cell_2_001').append(newSelect2);
The administrator has disabled public write access.

hide a cell in array dual scale 7 months 2 weeks ago #104237

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4185
  • Thank you received: 785
  • Karma: 359
No, for the first element it would be ":eq(0)" (indexes start at 0).


.
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.
Moderators: ITEd
Time to create page: 0.144 seconds
Donation Image