Jump to content
Toggle menu
  • 915 articles
  • 3.8K files
  • 30.2K users
  • 279.2K edits
Catglobe Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Convert closed question TextBox into TextArea: Difference between revisions

From Catglobe Wiki
Line 1: Line 1:
== Challenge ==
== Challenge ==
In Single question or Multi Question, a textbox might not enough for respondent to give a long answer.<br/>
As a questionnaire creator <br/>
I want to convert a textbox into a textarea.


[[File:BeforeConvert.PNG]]
In Single question or Multi Question, a textbox might not enough for respondent to give a long answer.<br> As a questionnaire creator <br> I want to convert a textbox into a textarea.  


[[File:AfterConvert.PNG]]
<br> '''Example:'''
 
= [[Image:BeforeConvert.PNG]]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'''=&gt;''' &nbsp; &nbsp; &nbsp;&nbsp; [[Image:AfterConvert.PNG]] =


== Code ==
== Code ==

Revision as of 05:47, 19 October 2009

Challenge

In Single question or Multi Question, a textbox might not enough for respondent to give a long answer.
As a questionnaire creator
I want to convert a textbox into a textarea.


Example:

       =>       

Code

quest.onInit = function()
{
    $.each($("input[type='text']"), function()
    {
        var inputName = this.name;
        var inputValue = this.value;
        var answerOptionValue = inputName.slice(inputName.lastIndexOf(".") + 1);

        if ($("input[value='" + answerOptionValue + "']").attr("checked"))
            $(this).replaceWith("<textarea rows='8' cols='55' name='" + inputName + "'>" + inputValue + "</textarea>");
        else
            $(this).replaceWith("<textarea rows='8' cols='55' disabled = 'disabled'  name='" + inputName + "'>" + inputValue + "</textarea>");
    });
}