beyond html

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

beyond html

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:42 pm

by rob >> Thu, 21 Oct 2004 20:46:29 GMT

Standard html does not appear to support the readOnly attribute on radio buttons, or allow textbox entry to be restricted to numeric only. Can any html/javascript gurus suggest ways to emulate this behaviour on a web page?

Thanks,
Rob

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: beyond html

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:42 pm

by allistar >> Sat, 23 Oct 2004 3:45:06 GMT

Read only radio buttons could be simulated using an image, but the problem is you don't know how the client OS/browser will render radio buttons, so yo ucan't guarantee it will like like standard radio buttons. You could alwaysflip the selection of the radio button when the user clicks it by using javascript. Similarly with numeric only entry on text boxes. The problem with javascript solutions is that it only works if the client has javascript enabled.

Allistar.
--
------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst allistar@silvermoon.co.nz
Auckland, NEW ZEALAND

Silvermoon Software
Specialising in JADE development and consulting
Visit us at: http://www.silvermoon.co.nz
*NEW* Simple web access to Jade at: www.silvermoon.co.nz/jhp.html ------------------------------------------------------------------

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: beyond html

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:42 pm

by Stephen >> Mon, 1 Nov 2004 3:31:03 GMT

For teh radio buttons, just set disabled=true
Eg <input type="radio" name="favouritefood" value="greeneggs" disabled="true">Green Eggs and Ham

For the numeric only textbox, it can only be done using javascript. Put a method on the "onBlur" (lost focus) that checks if the numeric value of the text = the actual text.
Eg.
<textarea id="favouritenumber" onblur="if(parseFloat(this.value) != this.value) alert('Numbers only please...')"></textarea>

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: beyond html

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:42 pm

by rob >> Tue, 2 Nov 2004 2:09:39 GMT

Stephen, much appreciated ...
Rob


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 16 guests