Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-06-21 07:32:44

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,587
Website

comments forms - class for buttons issue

A recent [1] update added classes to form controls (buttons in particular).
One of those classes is .disabled (applied to the disabled submit button).
Could this class name be changed to .button-disabled or similar ?
Reason: that submit button also has the attribute disabled="disabled". Personally I have no use for those classes, but I might be interested in using the disabled attribute, or the value of that attribute.

[1] or not really recent, I’m just slow in checking some things … :-)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#2 2007-06-21 08:57:15

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: comments forms - class for buttons issue

Can you explain how having a class called .disabled conflicts with using an attribute called disabled?

Offline

#3 2007-06-21 11:42:12

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,391
Website GitHub Mastodon

Re: comments forms - class for buttons issue

This class was purposely added to aid browsers with poor CSS3 support which do not understand input:disabled or similar pseudo classes. What’S wrong with that?

Offline

#4 2007-06-21 12:45:53

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,587
Website

Re: comments forms - class for buttons issue

wet wrote:

This class was purposely added to aid browsers with poor CSS3 support which do not understand input:disabled or similar pseudo classes. What’S wrong with that?

There is nothing wrong with appending a class to that button in itself (and I know perfectly well why you’ve added it: cough crappy IE cough cough; a normal browser would be perfectly fine with the whole range of attribute selectors). My objections is the name of the class: ‘.disabled’. My suggestion is to rename it to ‘.button_disabled’ or something similar (with an underscore rather than hyphen as suggested in first post, to be consistent with other hard-coded class names used – on other input elements)

Ruud wrote:

Can you explain how having a class called .disabled conflicts with using an attribute called disabled?

e.g. one could use scripts that look for the value ‘disabled’ of html attributes, which would double catch that particular button – it has an value of ‘disabled’ for the class attribute and a value of ‘disabled’ for the disabled attribute.

By renaming that class, you avoid possible clashes.

(It is a simple change in publish/comments.php – I’d send you a patch put my TXP tree is full of little hacks atm – I need to et up a clean tree somewhere)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#5 2007-06-21 13:05:51

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: comments forms - class for buttons issue

phiw13 wrote:

e.g. one could use scripts that look for the value ‘disabled’ of html attributes, which would double catch that particular button – it has an value of ‘disabled’ for the class attribute and a value of ‘disabled’ for the disabled attribute.

I’d consider a script that behaves like that to be seriously broken. It would also prevent you from using “disabled” in the value attribute and that’s something you cannot prevent in forms that allow you to correct errors after submitting (user input is then stored in the value attribute).

If the class name is inconsistent with an existing class naming policy in TXP (if such a policy exists), that’s a different matter and if it was introduced after 4.0.4 then sure, we should change it.

Last edited by ruud (2007-06-21 13:10:25)

Offline

#6 2007-06-22 00:26:40

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: comments forms - class for buttons issue

Yes, that should never happen, a class and an attribute are two totally different things in JavaScript.

Offline

#7 2007-06-27 10:28:51

The-Exit
Member
From: Berlin
Registered: 2005-07-16
Posts: 175
Website

Re: comments forms - class for buttons issue

I think, to have the class .button and .disabled is rather smart. So I used the class .button to style both buttons with css.

then i added a .disabled class where i overwrite some properties. so i can change the color of the button.

Additionally, I use the cursor: not-allowed; for disabled. then the user really can see, that he cannot click the disabled button.

Offline

#8 2007-06-27 10:31:42

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,391
Website GitHub Mastodon

Re: comments forms - class for buttons issue

I’m glad to hear this feature is even useful to a hard working scientist :)

Offline

Board footer

Powered by FluxBB