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

TOPIC: Display < " > correctly in response options?

Display < " > correctly in response options? 1 year 2 months ago #4217

I am working on my quiz for my XHTML class and am having an issue with how it displays on the front end.

They are multiple choice questions with the following options (For one question):
<html>
<header>
<title>
<body>

However, if you take a look at this image, you can see how they are displaying.

dl.dropbox.com/u/145086/Quiz-1.png

How can I fix this?

Running Mad Blanks v1.8.1 on Joomla 2.5.3
Last Edit: 1 year 2 months ago by kraymitchell.
The administrator has disabled public write access.

Re: Display < " > correctly in response options? 1 year 2 months ago #4218

  • chris
  • chris's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1473
  • Thank you received: 15
  • Karma: 5
When the characters < " > are used directly, they are translated into HTML entities and the extra semicolons interfere with separating the options. Try the following replacements:

replace < with [:lt:]
replace > with [:gt:]
replace " with [:quot:]

(Note that [:lquot:] is also available for a "literal quotation mark"; this can be useful sometimes in Score Scripts.)

So your list of options would be
[:lt:]html[:gt:];[:lt:]header[:gt:];[:lt:]title[:gt:];[:lt:]body[:gt:]

You would use the same replacements in the default and correct answers that you may have specified.
[:lt:]html[:gt:]
The administrator has disabled public write access.
The following user(s) said Thank You: kraymitchell

Re: Display < " > correctly in response options? 1 year 2 months ago #4257

OK, I am working on the second quiz for my students. I want them to put in the HTML code for a copyright symbol.

I seem to have 2 issues though.

First, when it displays the answers back after they complete, it shows the copyright symbol if you put in the correct answer. How do I make it display in plain text?

Secondly, the answer doesn't display properly either.
I have this in the correct answer field:

[:amp:]copy;

but it displays on the front end as

© and
The administrator has disabled public write access.

Re: Display < " > correctly in response options? 1 year 2 months ago #4270

  • chris
  • chris's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1473
  • Thank you received: 15
  • Karma: 5
You can set the correct answer as:
[:lamp:]copy[:semicol:]

The tag [:lamp:] resolves to a literal ampersand, as opposed to the HTML entity that [:amp:] resolves to.

Regarding © showing up as the user's answer, I'll have to get back to you with a fix.
The administrator has disabled public write access.
The following user(s) said Thank You: kraymitchell

Re: Display < " > correctly in response options? 1 year 2 months ago #4299

  • chris
  • chris's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1473
  • Thank you received: 15
  • Karma: 5
I considered changing the behavior in the new Mad Blanks 1.8.2 Beta 1 I just released, but decided against it to maintain consistency for existing applications.

What you can do, however, is if you know you're looking for HTML entities in the answers, use the replace tag in the Score Script.

So, where you would normally have the plain [:user_response:] tag inside an each:answer loop (like in Generic Score Script #1), use the following:
[:replace:{[:lamp:]}:{[:amp:]}:<start>:][:user_response:][:replace:<end>:]

That will replace literal ampersands with the ampersand entity & in the user's answer so it won't show up as ©.

You can do the same thing with, for example, the [:correct_value:] tag (also inside the each:answer loop in Generic Score Script #1):
[:replace:{[:lamp:]}:{[:amp:]}:<start>:][:correct_value:][:replace:<end>:]

Does that make sense and seem reasonable? By the way, I did add a [:copy:] Score Script tag to Mad Blanks 1.8.2 Beta 1, so it will be there in future releases.
Last Edit: 1 year 2 months ago by chris.
The administrator has disabled public write access.
The following user(s) said Thank You: kraymitchell

Re: Display < " > correctly in response options? 1 year 2 months ago #4300

Thanks again Chris!

How do I format the score script for stripping white space, do I add it around the user_response just like the replace?
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.433 seconds

This is the official website for Mad Blanks, a component written for Joomla!™

Mad Blanks, when used with Joomla!™, will allow you to give a quiz on your site. You can also use it to give a survey. Quizzes and surveys are popular applications on the Internet, including personality quizzes, name generators, and assessments.

This website and the featured software products herein written for Joomla!™ are the property of Chris Hallett, an independent programmer. Chris does not represent Open Source Matters, Inc. nor the Joomla!™ project.

Mad Blanks, Mad Current Event, and Mad Simple True False Quiz are licensed under the GNU General Public License (GPL) version 2.

www.madblanks.com | Mad Blanks - Quiz, survey, assessment, calculator, general purpose form

Terms & Conditions | Privacy Policy | Contact Us | © 2013 Chris Hallett

Tuesday the 18th. Joomla Templates Free.