Welcome, Guest
Username: Password: Remember me

TOPIC: Default text input in array-multi-flexi-text

Default text input in array-multi-flexi-text 3 years 4 months ago #52542

  • joteczek
  • joteczek's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
Hello! I've problem with designing questions.

I've 1.90+ Build 9459 version. I have a array-multi-flexi-text mandatory question with 2 columns (City, Number of people in City) and 5 rows (1, 2, 3, 4, 5). I want to have a default answer in all of the input text fields in this question (for example 'NONE').

My question is: how can I do this? I've looked into Default values in array questions topic and there is a solution but only for checked/unchecked radio buttons.

Can anyone help me?
The administrator has disabled public write access.

Re:Default text input in array-multi-flexi-text 3 years 4 months ago #52555

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
There is no setting for default answers in array-multi-flexi-text inputs but you can use JavaScript to cheat.

Set up your survey to use JavaScript and place the following script in the source of the array question or the group description. Replace "QQ" (line 5) with the ID of the array question and modify the default value (line 6) as necessary.
<script type="text/javascript" charset="utf-8">
 
    $(document).ready(function() {
 
        var qID = QQ;
        var  defaultVal = 'None';
 
        // Loop text inputs and load default value
        $('#question'+qID+' input[type="text"]').each(function(i) {
 
            if (!$(this).val()) {
                $(this).val(defaultVal);
            }
        });
 
    });
 
</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.
The administrator has disabled public write access.

Re:Default text input in array-multi-flexi-text 3 years 4 months ago #52556

  • joteczek
  • joteczek's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
Thank you! It's working!
The administrator has disabled public write access.

Re:Default text input in array-multi-flexi-text 3 years 4 months ago #52573

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5275
  • Thank you received: 289
  • Karma: 246
You're welcome!

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.

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