Solved

Disabled Fieldset Attribute in HTML5

Posted on 2013-11-15
7
641 Views
Last Modified: 2013-11-15
Hi

I have a form (as below) and depending on whether it's in edit mode or view mode I lock the form elements. This is fine. The issue i have is with ie 9 which doesnt support the html5 disabled attribute

whats the best way of going about this, what kind of polyfill would i need ?

(I am using bootstrap 3)

<fieldset disabled>
                    
                    
<div class="form-group">
 <label for="clientname" class="col-lg-2 control-label">Company Name</label>
 <div class="col-lg-10">
 <input title="The name of the Client" value="<?php echo $ClientName?>" type="text" class="form-control initial_caps" id="clientname" placeholder="The name of the Client" name="clientname" >
                          
</fieldset>

Open in new window

0
Comment
Question by:maddisoncr
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 19

Expert Comment

by:Albert Van Halen
ID: 39651119
Perhaps you can disabled the first div in the fieldset...
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39651130
Hi,
you might try this jQuery function:
var disabledFieldset = $('fieldset[disabled]');
$('input', disabledFieldset).attr('disabled', 'disabled');

Open in new window


This should disable all input fields in your fieldset.
HTH
Rainer
0
 

Author Comment

by:maddisoncr
ID: 39651153
thanks guys

that will work for browsers that support 'disabled' but i'm led to believe that ie 9 doesn't.

how would i go around testing to see if the browser supports the attribute..

i'm from a vb.net backround so i'm quickly learning the ropes. i did think modernizr but that doesn't check for the disabled attr..

any ideas

thanks again for your help
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 125 total points
ID: 39651185
Hi,
IE9 would not directly support the disabled on the fieldset but at least the disabled on the INPUT fields (even disabling option values is supported in IE9 - http://msdn.microsoft.com/en-us/library/ie/ms533732%28v=vs.85%29.aspx)
0
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 125 total points
ID: 39651399
For non input elements like fieldset, The disable attribute is new with HTML5 and not supported in IE9 or Safari.  The solution is to use the older more reliable approach of setting disabled on the inputs which is supported by all mainstream browsers and has been for at least 5 years.  It can be applied to all input types except 'hidden'.

Cd&
0
 

Author Closing Comment

by:maddisoncr
ID: 39651433
Thanks for your help
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39651567
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now