[Xerte] Re: XOT 101 - Adding HTML/JS to a Text Page

Smith, Bradley brsmith at akamai.com
Tue Apr 28 18:29:11 BST 2015


I’d just like to chime in and say that I’m reading this thread with interest, and looking forward to trying some of this stuff out. From my experience hacking on XOT off and on and following this list for a while now, one of the biggest barriers I’ve encountered to starting to develop my own content types is that doing so seems to be so easy that those who know how take it for granted, and those who don’t remain in the dark about exactly what this easy process entails. ;) 

If/when I get around to trying to create my own content types I’ll try writing up what I learn and submitting it to the wiki on github, but if someone who already knows wouldn’t mind writing up even some basic guidelines including and expanding on what’s come up in this thread, I think it would be a great help to others in the future.

—Brad

> On Apr 28, 2015, at 8:24 AM, Smith, John <J.J.Smith at gcu.ac.uk> wrote:
> 
> Hi,
> 
> There is a problem with line breaks being converted to <br> tags, usually this is  desirable... inside script tags it is definitely not...
> 
> My advice Kent would be to learn some jQuery... for your application, in its simplest form
> 
> Add up Carbs:
> <input type="text" id="qty1"/><br>
> <input type="text" id="qty2"/><br>
> <br><br>
> Total : <input type="text" id="total"/>
> <script>$('input').blur( function() { $('#total').val(Number($('#qty1').val()) + Number($('#qty2').val())); });</script>
> 
> Paste that into any text box and it should work...
> 
> Regards,
> 
> John Smith | Learning Technologist
> Room A250, Govan Mbeki Building | School of Health & Life Sciences | Glasgow Caledonian University
> Cowcaddens Road | Glasgow | G4 0BA
> 
> Please address ALL support requests to hlsblt at gcu.ac.uk <mailto:hlsblt at gcu.ac.uk> where one of the School Learning Technologists will pick up the job. This will ensure that all jobs are completed as promptly as possible.
> ________________________________________
> From: xerte-bounces at lists.nottingham.ac.uk <mailto:xerte-bounces at lists.nottingham.ac.uk> [xerte-bounces at lists.nottingham.ac.uk <mailto:xerte-bounces at lists.nottingham.ac.uk>] On Behalf Of Julian Tenney [Julian.Tenney at nottingham.ac.uk <mailto:Julian.Tenney at nottingham.ac.uk>]
> Sent: 28 April 2015 13:20
> To: Xerte discussion list
> Subject: [Xerte] Re: XOT 101 - Adding HTML/JS to a Text Page
> 
> I put this in an embed Content page and it works – it didn’t work in a plain text page…
> 
> <p>Adding Numbers</p>
> <input onblur="add();" type="text" id="txt1"/>
> <input onblur="add();" type="text" id="txt2"/>
> <input type="text" id="txt3"/>
> 
> <script>
> 
> function add(){
> 
>  alert("adding" + document.getElementById('txt1').value + " and " + document.getElementById('txt2').value);
> 
> }
> 
> </script>
> 
> From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Kent
> Sent: 28 April 2015 12:32
> To: Xerte Lists
> Subject: [Xerte] XOT 101 - Adding HTML/JS to a Text Page
> 
> I need a page with a few input fields.  I want to sum the numbers from the fields into a total field.  Easy enough to add the fields to a Text page by putting the following into the "Page Text" field.
> 
> Add up Carbs:
> <input onblur="findTotal()" type="text" name="qty" id="qty2"/><br>
> <input onblur="findTotal()" type="text" name="qty" id="qty2"/><br>
> <br><br>
> Total : <input type="text" name="total" id="total"/>
> 
> To define the FindTotal() routine, I need to add a <script> section.
> 
> <script type="text/javascript">
>    function findTotal(){
>     // some JS code here
>    }
> </script>
> 
> As soon as I add the script section, the fields will no longer show up when I press Play.  I'm not sure what I'm doing wrong.
> 
> Any advice would be much appreciated.
> 
> Have a great day,
> Kent
> 
> 
> 
> 
> This message and any attachment are intended solely for the addressee
> and may contain confidential information. If you have received this
> message in error, please send it back to me, and immediately delete it.
> 
> Please do not use, copy or disclose the information contained in this
> message or in any attachment.  Any views or opinions expressed by the
> author of this email do not necessarily reflect the views of the
> University of Nottingham.
> 
> This message has been checked for viruses but the contents of an
> attachment may still contain software viruses which could damage your
> computer system, you are advised to perform your own checks. Email
> communications with the University of Nottingham may be monitored as
> permitted by UK legislation.
> 
> 
> Glasgow Caledonian University is a registered Scottish charity, number SC021474
> 
> _______________________________________________
> Xerte mailing list
> Xerte at lists.nottingham.ac.uk <mailto:Xerte at lists.nottingham.ac.uk>
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte <http://lists.nottingham.ac.uk/mailman/listinfo/xerte>
> 
> 
> 
> 
> This message and any attachment are intended solely for the addressee
> and may contain confidential information. If you have received this
> message in error, please send it back to me, and immediately delete it. 
> 
> Please do not use, copy or disclose the information contained in this
> message or in any attachment.  Any views or opinions expressed by the
> author of this email do not necessarily reflect the views of the
> University of Nottingham.
> 
> This message has been checked for viruses but the contents of an
> attachment may still contain software viruses which could damage your
> computer system, you are advised to perform your own checks. Email
> communications with the University of Nottingham may be monitored as
> permitted by UK legislation.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20150428/20013094/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4291 bytes
Desc: not available
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20150428/20013094/attachment-0001.bin>


More information about the Xerte mailing list