Solved

Disabled Fieldset Attribute in HTML5

Posted on 2013-11-15
7
670 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

820 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