Welcome, Guest
Username: Password: Remember me

TOPIC: Numerical Input - maxlength properties

Numerical Input - maxlength properties 3 years 10 months ago #51373

  • AkeB0N0
  • AkeB0N0's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 1
  • Karma: 0
Hello,
we would like to create a numerical input question which is has to be width 22 characters. But, Limesurvey doesn't accept more than 20 characters.

As you can see the following code, the maxsize properties controlling the input value which has been set as 20. So, my question is, if we change that properties, the script can continue the work?
function do_numerical($ia)
{
    global $clang;
 
    if ($ia[8] == 'Y')
    {
        $checkconditionFunction = "checkconditions";
    }
    else
    {
        $checkconditionFunction = "noop_checkconditions";
    }
    $qidattributes=getQuestionAttributes($ia[0],$ia[4]);
    if (trim($qidattributes['prefix'])!='') {
        $prefix=$qidattributes['prefix'];
    }
    else
    {
        $prefix = '';
    }
    if (trim($qidattributes['suffix'])!='') {
        $suffix=$qidattributes['suffix'];
    }
    else
    {
        $suffix = '';
    }
    if (trim($qidattributes['maximum_chars'])!='')
    {
        $maxsize=$qidattributes['maximum_chars'];
        if ($maxsize>20)
        {
            $maxsize=20;
        }
    }
    else
    {
        $maxsize=20;  // The field length for numerical fields is 20
    }
    if (trim($qidattributes['text_input_width'])!='')
    {
        $tiwidth=$qidattributes['text_input_width'];
    }
    else
    {
        $tiwidth=10;
    }
    // --> START NEW FEATURE - SAVE
    $answer = "<p class=\"question\">\n\t$prefix\n\t<input class=\"text\" type=\"text\" size=\"$tiwidth\" name=\"$ia[1]\" "
    . "id=\"answer{$ia[1]}\" value=\"{$_SESSION[$ia[1]]}\" alt=\"".$clang->gT('Answer')."\" onkeypress=\"return goodchars(event,'0123456789.')\" onchange='$checkconditionFunction(this.value, this.name, this.type)'"
    . "maxlength=\"$maxsize\" />\n\t$suffix\n</p>\n";
    if ($qidattributes['hide_tip']==0)
    {
        $answer .= "<p class=\"tip\">".$clang->gT('Only numbers may be entered in this field')."</p>\n";
    }
The administrator has disabled public write access.

Re:Numerical Input - maxlength properties 3 years 10 months ago #51593

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
Just test. Worst case is that you enter a huge number like 3205739502459237502752 which can't be stored at the database.

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.152 seconds
Donation Image