Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

How to add custom css and js files

  • Kevin01
  • Kevin01's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 5 months ago #142441 by Kevin01
Replied by Kevin01 on topic How to add custom css and js files
This link had some nice stuff for mobile devices. www.w3schools.com/jquerymobile/jquerymobile_navbars.asp
The topic has been locked.
  • Kevin01
  • Kevin01's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 5 months ago #142443 by Kevin01
Replied by Kevin01 on topic How to add custom css and js files
It's not pulling from my edited answer_row_other.php
I added <!-- Kevin --> and viewing the source of the webpage does not show it.

Directory structure: /upload/templates/mobile/views/survey/questions/listradio/rows

config.xml:
<overwrite_question_views>true</overwrite_question_views>

config.php
'config'=>array(
'debug'=>0,
'debugsql'=>0,
'allow_templates_to_overwrite_views'=>1
)

Question type is "List (radio)"
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
7 years 5 months ago #142445 by LouisGac
Replied by LouisGac on topic How to add custom css and js files
To be sure the custom views are loaded, I'd advise you to add something very visible in the view, like a: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" :laugh:

Also, be sure that you're using the right template in your survey... file permissions, etc

Be sure that what is going wrong is a very little thing.
The topic has been locked.
  • Kevin01
  • Kevin01's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 5 months ago - 7 years 5 months ago #142448 by Kevin01
Replied by Kevin01 on topic How to add custom css and js files
It must not be using the correct template because I edited the startpage.pspl and my change did not appear. I'll be back :) <saying with Arnold Arnold Schwarzenegger's accent>
Last edit: 7 years 5 months ago by Kevin01.
The topic has been locked.
  • Kevin01
  • Kevin01's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 5 months ago #142449 by Kevin01
Replied by Kevin01 on topic How to add custom css and js files
Found it... I added a line to answer_row.php
It's pulling from the correct place. Now, lets see if I can make cool buttons :)
The topic has been locked.
  • Kevin01
  • Kevin01's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 5 months ago - 7 years 5 months ago #142450 by Kevin01
Replied by Kevin01 on topic How to add custom css and js files
Its close... It toggles left to right.. I'd like it to toggle up and down. I'll see what I can do but this might be in the bootstrap file?
Last edit: 7 years 5 months ago by Kevin01.
The topic has been locked.
  • Kevin01
  • Kevin01's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 5 months ago #142451 by Kevin01
Replied by Kevin01 on topic How to add custom css and js files
Closer:


<!-- answer_row -->
<!--
<div id='javatbd<?php echo $myfname; ?>' class='col-xs-12 form-group answer-item radio-item radio' <?php echo $sDisplayStyle; ?> >
<input
class="radio"
type="radio"
value="<?php echo $code; ?>"
name="<?php echo $name; ?>"
id="answer<?php echo $name.$code; ?>"
<?php echo $checkedState;?>
onclick="if (document.getElementById('answer<?php echo $name; ?>othertext') != null) document.getElementById('answer<?php echo $name; ?>othertext').value='';checkconditions(this.value, this.name, this.type)"
aria-labelledby="label-answer<?php echo $name.$code; ?>"
/>
<label for="answer<?php echo $name.$code; ?>" class="control-label radio-label"></label>

-->

<div class="btn-group" data-bs-toggle="buttons">
<label class="btn btn-primary">
<input
type="radio"
name="<?php echo $name; ?>"
id="answer<?php echo $name.$code; ?>"

<?php echo $checkedState;?>
onclick="if (document.getElementById('answer<?php echo $name; ?>othertext') != null) document.getElementById('answer<?php echo $name; ?>othertext').value='';checkconditions(this.value, this.name, this.type)"
aria-labelledby="label-answer<?php echo $name.$code; ?>"
/>

<label for="answer<?php echo $name.$code; ?>" class="control-label radio-label"></label>
</div>
Attachments:
The topic has been locked.
  • Kevin01
  • Kevin01's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 5 months ago - 7 years 5 months ago #142456 by Kevin01
Replied by Kevin01 on topic How to add custom css and js files
Do you know what I am missing in the code that is not allowing it to save a value? I attached images.

Reference: www.w3schools.com/bootstrap/tryit.asp?fi...tton_block&stacked=h

Original Code that works:

<?php
/**
* Multiple Choice Html : item row
*
* @var $name
* @var $code
* @var $answer
* @var $checkedState
* @var $myfname
*/
?>

<!-- answer_row -->
<div id='javatbd<?php echo $myfname; ?>' class='col-xs-12 form-group answer-item radio-item radio' <?php echo $sDisplayStyle; ?> >
<input
class="radio"
type="radio"
value="<?php echo $code; ?>"
name="<?php echo $name; ?>"
id="answer<?php echo $name.$code; ?>"
<?php echo $checkedState;?>
onclick="if (document.getElementById('answer<?php echo $name; ?>othertext') != null) document.getElementById('answer<?php echo $name; ?>othertext').value='';checkconditions(this.value, this.name, this.type)"
aria-labelledby="label-answer<?php echo $name.$code; ?>"
/>
<label for="answer<?php echo $name.$code; ?>" class="control-label radio-label"></label>

<!--
The label text is provided inside a div,
so final user can add paragraph, div, or whatever he wants in the subquestion text
This field is related to the input thanks to attribute aria-labelledby
-->
<div class="label-text label-clickable" id="label-answer<?php echo $name.$code; ?>">
<?php echo $answer; ?>
</div>
</div>





My code that does not work:
<?php
?>

<!-- answer_row -->

<div id='javatbd<?php echo $myfname; ?>' class='col-xs-12 form-group answer-item radio-item radio' <?php echo $sDisplayStyle; ?> >

<div class="container-fluid">
<input
class="btn btn-primary btn-block"
type="button"
value="<?php echo $code; ?>"
name="<?php echo $name; ?>"
id="answer<?php echo $name.$code; ?>"
<?php echo $checkedState;?>
onclick="if (document.getElementById('answer<?php echo $name; ?>othertext') != null) document.getElementById('answer<?php echo $name; ?>othertext').value='';checkconditions(this.value, this.name, this.type)"
aria-labelledby="label-answer<?php echo $name.$code; ?>"
/>
</div>
</div>
Last edit: 7 years 5 months ago by Kevin01.
The topic has been locked.
  • Kevin01
  • Kevin01's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 5 months ago #142457 by Kevin01
Replied by Kevin01 on topic How to add custom css and js files
This might be easier to follow.
Attachments:
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
7 years 5 months ago #142460 by LouisGac
Replied by LouisGac on topic How to add custom css and js files

Kevin wrote: Do you know what I am missing in the code that is not allowing it to save a value?

A simple way to solve this kind of problem is to keep all the old inputs in a hidden div, and via JS to trigger a click on them when user click on your new input.

Else, if you want to do it "native", you should check that all the id, values, names, classes, etc are correctly parsed.
The topic has been locked.
  • Kevin01
  • Kevin01's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 5 months ago #142472 by Kevin01
Replied by Kevin01 on topic How to add custom css and js files
Thanks.
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
7 years 5 months ago #142475 by LouisGac
Replied by LouisGac on topic How to add custom css and js files

Kevin wrote: Thanks.


there is a special button to thanks :P

did you get it working?
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose