Solved

Disabled Fieldset Attribute in HTML5

Posted on 2013-11-15
7
658 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Suggested Solutions

Title # Comments Views Activity
How to Left-Align Navigation bar? 4 26
How to make footer stick to bottom 9 28
Increase the size of the modal in Bootstrap 5 24
Outlook opens HTML email as text 4 22
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

776 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