HTML: cursor showing in readonly input text?

My solution, from nikmd23’s jQuery snippet but with the blur() function that seems to work better $(‘input[readonly]’).focus(function(){ this.blur(); }); Example here: http://jsfiddle.net/eAZa2/ Don’t use the attribute “disabled” because the input would not be submitted when it is part of a form Sounds like a bug! There is a similar bug (396542) open with Mozilla, saying … Read more

Readonly models in Django admin interface?

The admin is for editing, not just viewing (you won’t find a “view” permission). In order to achieve what you want you’ll have to forbid adding, deleting, and make all fields readonly: class MyAdmin(ModelAdmin): def has_add_permission(self, request, obj=None): return False def has_delete_permission(self, request, obj=None): return False (if you forbid changing you won’t even get to … Read more

Why Tuple’s items are ReadOnly?

Tuples originated in functional programming. In (purely) functional programming, everything is immutable by design – a certain variable only has a single definition at all times, as in mathematics. The .NET designers wisely followed the same principle when integrating the functional style into C#/.NET, despite it ultimately being a primarily imperative (hybrid?) language. Note: Though … Read more

How to get around lack of covariance with IReadOnlyDictionary?

You could write your own read-only wrapper for the dictionary, e.g.: public class ReadOnlyDictionaryWrapper<TKey, TValue, TReadOnlyValue> : IReadOnlyDictionary<TKey, TReadOnlyValue> where TValue : TReadOnlyValue { private IDictionary<TKey, TValue> _dictionary; public ReadOnlyDictionaryWrapper(IDictionary<TKey, TValue> dictionary) { if (dictionary == null) throw new ArgumentNullException(“dictionary”); _dictionary = dictionary; } public bool ContainsKey(TKey key) { return _dictionary.ContainsKey(key); } public IEnumerable<TKey> Keys … Read more

How can I enable jquery validation on readonly fields?

Thank you for you suggestion Panoptik, adding readonly on focusin, and then removing it on focusout was the cleanest way, million thanks! I answer myself in case anyone has the same problem. Hope it helps. $(document).on(“focusin”, “#someid”, function() { $(this).prop(‘readonly’, true); }); $(document).on(“focusout”, “#someid”, function() { $(this).prop(‘readonly’, false); });

What is the correct readonly attribute syntax for input text elements?

HTML5 spec: http://www.w3.org/TR/html5/forms.html#attr-input-readonly : The readonly attribute is a boolean attribute http://www.w3.org/TR/html5/infrastructure.html#boolean-attributes : The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. If the attribute is present, its value must either be the empty string or a value that is an … Read more