Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Radio button and textbox combined in one question

Radio button and textbox combined in one question 1 Jahr 2 Monate her #95388

  • fenden
  • fendens Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Karma: 0
Dear LimeSurvey Team,

I'm trying to create a question (default template) in which the user can either type in text into a (free standing) text box or enable a radiobutton. The both input types shall appear one below the other and must be exclusive, so that if there is text in the box, the radiobutton gets deactivated.
Unfortunately I could not accomplish this so far and would be very grateful for any help.

Greetings from Germany,
Fenden
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Radio button and textbox combined in one question 1 Jahr 2 Monate her #95392

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4050
  • Dank erhalten: 740
  • Karma: 341
Can't you just use a radio question with "Other" enabled?


Capture2_2013-04-28.JPG
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Radio button and textbox combined in one question 1 Jahr 2 Monate her #95394

  • fenden
  • fendens Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Karma: 0
The textbox has to be above the radio button and should have no text in front.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Radio button and textbox combined in one question 1 Jahr 2 Monate her #95398

  • fenden
  • fendens Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Karma: 0
Is it possible to switch the other option with an option above? And to not give the other option a name/label?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Radio button and textbox combined in one question 1 Jahr 2 Monate her #95399

  • holch
  • holchs Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 2549
  • Dank erhalten: 285
  • Karma: 102
You can freely choose the text that is given to the other option. You might have to put at least a space, because otherwise it probably will use the default option.

I don't think that you can move the "other" option up in LS. But probably you can do something with Javascript. But I have no clue about that.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Radio button and textbox combined in one question 1 Jahr 2 Monate her #95414

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4050
  • Dank erhalten: 740
  • Karma: 341
1) Set up your survey to use JavaScript.

2) Add the following script to the source of the question. The script will hide The "Other" radio and label and move the text input to the top of the list.
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
 
		// Identify this question
		var q1ID = '{QID}';
		var q1 = $('#question'+q1ID+'');
 
		// Hide the "Other" radio button and label
		$('.other-item input.radio, .other-item .answertext', q1).hide();
 
		// Move the "Other" row to the top
		$('.radio-list', q1).prepend($('.other-item', q1));
	});
</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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.140 Sekunden
Donation Image