Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: How to make others field text only ?

How to make others field text only ? 2 years 4 months ago #79679

  • JackChow
  • JackChow's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
Hi,

I recently started using limesurvey and trying to set up a survey online. I have two questions in particular

1) How can I make others field to allow text only ? I see we have option for numbers only.

2) I would like to change the admin login url. Eg: limesurvey.com/admin to limesurvey.com/backend
The administrator has disabled public write access.

Re: How to make others field text only ? 2 years 4 months ago #79684

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6334
  • Thank you received: 818
  • Karma: 243
Hello,

For 2:
Maybe you can see in config-default.php:
$homeurl                 = "$rooturl/admin";         // The website location (url) of the admin scripts
$homedir                 = "$rootdir".DIRECTORY_SEPARATOR."admin";       // The directory path of the admin scripts

For 1: i don't understand exactly what you want, you want only a to z and A to Z caracter ?

Try
regexMatch('[a-zA-Z]',this)
or something like that in Sub-question validation equation
The administrator has disabled public write access.
The following user(s) said Thank You: JackChow

Re: How to make others field text only ? 2 years 4 months ago #79692

  • JackChow
  • JackChow's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
Thanks for your reply.

I want to allow only text(a-z or A-Z) in the others field of list with radio buttons.

I have option for only allow numbers in advanced options. Where should I put that regex exp ? I don't see any validation field.
The administrator has disabled public write access.

Re: How to make others field text only ? 2 years 4 months ago #79696

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4192
  • Thank you received: 788
  • Karma: 359
I don't think there is a validation field for "Other" but you could put a mask onthe input field. Something like this workaround - docs.limesurvey.org/Workarounds%3A+Manip...vey#Text_input_masks
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.
The following user(s) said Thank You: JackChow

Re: How to make others field text only ? 2 years 4 months ago #79699

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6334
  • Thank you received: 818
  • Karma: 243
Hello,

Maybe some script like that:
$('question'+QQ' input.text').bind('keypress', function (event) {
    var regex = new RegExp("^[a-zA-Z]+$");
    var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
    if (!regex.test(key)) {
       event.preventDefault();
       return false;
    }
});
Or you can use some jquery plugin , this one bassistance.de/jquery-plugins/jquery-plugin-validation/ for example.
The administrator has disabled public write access.

Re: How to make others field text only ? 2 years 4 months ago #79712

  • JackChow
  • JackChow's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
Sorry for being noob. May I ask where should I include this script ?
The administrator has disabled public write access.

Re: How to make others field text only ? 2 years 4 months ago #79713

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6334
  • Thank you received: 818
  • Karma: 243
Hello,

Look at :
How to use Script (eg.JavaScript etc.) in LimeSurvey?
The administrator has disabled public write access.
The following user(s) said Thank You: JackChow

Re: How to make others field text only ? 2 years 4 months ago #79801

  • JackChow
  • JackChow's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
Hi,

Thanks for the links they are very useful. I have choose to implement the digitalbush plugin. Followed all instructions. But it is not working. Please find more information

<script type="text/javascript" charset="utf-8">
$(document).ready(function($) {
$("#answer55937X1X3").mask("999-99-9999",{ placeholder:"#" });
});
</script>

The survey logic is

Logic File for Survey # 55937

This question, by itself, does not contain any syntax errors

# Name [ID] Relevance [Validation] (Default) Text [Help] (Tip)
G-1 SECTION 1: BASIC PERSONAL AND HOUSEHOLD INFORMATION
[GID 1] 1
Q-5 *Q1_3
[QID 3]
List (radio) [L] 1
(VALIDATION: ((Q1_3.NAOK != '-oth-' || (Q1_3.NAOK == '-oth-' && strlen(trim(Q1_3_other.NAOK)) > 1))))
1.3 Level of Education



[HELP: ]
(TIP:
Please also fill in the "other comment" field.
)
Question Attribute Value
display_columns 1
other_comment_mandatory 1
SQ-1 Q1_3_other Other
A[0]-1 A1 [VALUE: A1] Elementary
A[0]-2 A2 [VALUE: A2] Primary
A[0]-3 A3 [VALUE: A3] Secondary
A[0]-4 A4 [VALUE: A4] Tertiary
A[0]-5 A5 [VALUE: A5] No Formal Education


I check the js file it is loading during the survey. I'm using 1.92 version of limesurvey. Any help is much appreciated.
The administrator has disabled public write access.

Re: How to make others field text only ? 2 years 4 months ago #79802

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4192
  • Thank you received: 788
  • Karma: 359
I can't speak to how well that plugin works but I believe the ID for the "Other" text input for a radio question should be something like 11111X22X33othertext.

Try changing:
$("#answer55937X1X3").mask("999-99-9999",{ placeholder:"#" });

To:
$("#answer55937X1X3othertext").mask("999-99-9999",{ placeholder:"#" });
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.
The following user(s) said Thank You: JackChow

Re: How to make others field text only ? 2 years 4 months ago #79803

  • JackChow
  • JackChow's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
Thanks a lot. It is working. Now I'm trying to figure out how to put condition a-z or A-Z.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.242 seconds
Donation Image