Unwanted line break between mandatory asterisk and question text

More
5 years 1 month ago #87246 by che
che created the topic: Unwanted line break between mandatory asterisk and question text
Hello, I'm using the Basic template in LimeSurvey 2.00. I've edited the question.pstpl and here is what I think is the relevant part:
<table width="100%" cellspacing="0" cellpadding="8" border="0">
					<tr>
						<td class="be">
                                                  <span class="asterisk">{QUESTION_MANDATORY}</span><br />{QUESTION_TEXT}<br /><span class="questionhelp">{QUESTION_HELP}</span>
 
							{QUESTION_MAN_MESSAGE}
							{QUESTION_VALID_MESSAGE}
							{QUESTION_FILE_VALID_MESSAGE}
						</td>
					</tr>
        	        <!--<tr><td><font size="-1"><i>{QUESTIONHELPPLAINTEXT}</i></font></td></tr>-->
					<tr>
						<td width="100%" class="answer">{ANSWER}</td>
					</tr>
	                <tr>
						<td class="survey-question-help">{QUESTIONHELP}</td>
					</tr>
				</table>



The problem is that there is a line/paragraph break between the mandatory asterisk and the question text. Screenshot attached. I also looked in template.css but nothing seems to stand out.

Any help? Thanks much.

Che



Attachments:

Please Log in to join the conversation.

More
5 years 4 weeks ago #87247 by lowprofile
lowprofile replied the topic: Unwanted line break between mandatory asterisk and question text
This is also the case for me, I would suspect its the phpeditor and the browser. Some browsers don't add it, firefox will if you save the question text directly in the regular phpUI.
If you are in the source and save it doesn't add the paragraph tag <p>

Please Log in to join the conversation.

More
5 years 4 weeks ago #87276 by tpartner
tpartner replied the topic: Unwanted line break between mandatory asterisk and question text
I don't see any <p> tags in your script but I do see a line break after the .asterisk span.

Try changing this:
<span class="asterisk">{QUESTION_MANDATORY}</span><br />{QUESTION_TEXT}<br /><span class="questionhelp">{QUESTION_HELP}</span>

T this:
<span class="asterisk">{QUESTION_MANDATORY}</span>$nbsp{QUESTION_TEXT}<br /><span class="questionhelp">{QUESTION_HELP}</span>

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 4 weeks ago #87322 by che
che replied the topic: Unwanted line break between mandatory asterisk and question text
@lowprofile -- thank you. It adds an extra step, but using the source works for me.

@tpartner -- thanks as well, but making that change didn't affect anything.

Thanks,
Che

Please Log in to join the conversation.

More
3 years 10 months ago #102985 by mrli999
mrli999 replied the topic: Unwanted line break between mandatory asterisk and question text
Is there solution in limesurvey 2.05? thanks

Please Log in to join the conversation.

More
3 years 10 months ago #102987 by mrli999
mrli999 replied the topic: Unwanted line break between mandatory asterisk and question text
Maybe you can check the "question" in source mode, if you can find <p></p>there, just delete it.
The following user(s) said Thank You: mikeu

Please Log in to join the conversation.

More
3 years 10 months ago #103008 by tpartner
tpartner replied the topic: Unwanted line break between mandatory asterisk and question text
You can use JavaScript to automatically detect the <p> element and if found, move the <span class="asterisk"> element into that <p>

For all shipped templates except those listed below, add this to the end of template.js:
$(document).ready(function(){
	// Fix the asterisk placement
	$.fn.tagName = function() {
		return this.get(0).tagName;
	}
	$('span.asterisk').each(function(i){
		if($(this).next().next().length > 0 && $(this).next().next().tagName().toLowerCase() == 'p') {
			$(this).prependTo($(this).next().next());
		}
	});
 
});

For the bluengrey, sherpa and vallendar templates, use this:
$(document).ready(function(){
	// Fix the asterisk placement
	$.fn.tagName = function() {
		return this.get(0).tagName;
	}
	$('span.asterisk').each(function(i){
		if($(this).next().length > 0 && $(this).next().tagName().toLowerCase() == 'p') {
			$(this).prependTo($(this).next());
		}
	});
 
});

.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!