Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.6.2

Request #8569 Make "requiredNote" more dom-friendly
Submitted: 2006-08-27 22:05 UTC
From: eduardo593734256 at gmail dot com Assigned: wiesemann
Status: Closed Package: HTML_QuickForm_Renderer_Tableless (version 0.3.3)
PHP Version: Irrelevant OS: Gnu/Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-08-27 22:05 UTC] eduardo593734256 at gmail dot com (Eduardo Marinho)
Description: ------------ This element needs a DOM node so it can be styled. Test script: --------------- Line 99, Tableless.php: From: "\n\t\t{requiredNote}"; To: "\n\t\t
{requiredNote}
";

Comments

 [2006-09-12 10:53 UTC] wiesemann (Mark Wiesemann)
Sorry for the delay on this request. If you (or anybody else) wants to style the required note, I'd suggest using $renderer->setRequiredNoteTemplate(). This gives you very much flexibility. Therefore, I would decline this request because setRequiredNoteTemplate() does this job already. Do you agree, or is there anything that I've overlooked?
 [2006-09-12 17:26 UTC] eduardo593734256 at gmail dot com
Hi, Mark! In the original renderer, the method is useful because the template is hard coded with "align" and else, so it's the way to quickly change it. In your renderer, not putting the notes in a DOM acessible place by default looks equivalent to hard coding the fixed style in the renderer, since you need to change the code, not the CSS, to do something related to the layout, which goes against the renderer's purpose. (at least in our case) Plus, this change would add many more use cases to the default behavior and reduce 1 duplicated line per form in most use cases.
 [2006-09-14 09:53 UTC] wiesemann (Mark Wiesemann)
Hi Eduardo, your point with the extra method call instead of allowing DOM styling is perfectly valid. I've commited a the changes into CVS, but with a slightly longer, more descriptive class name. I see one problem with this: QF uses the following required note string by default: var $_requiredNote = '<span style="font-size:80%; color:#ff0000;">*</span><span style="font-size:80%;"> denotes required field</span>'; If a user now declares a font-size or color in the new div.qfreqnote, his settings will be overridden by this. Do you have any comments on this? (Of course, this applies only to font-size and color, other styling like alignment is still possible.) Regards, Mark
 [2006-09-14 19:47 UTC] eduardo593734256 at gmail dot com
This looks like a problem in QF itself, since it's setting in RequiredNote data that should be in RequiredNoteTemplate exclusively. I didn't knew about this problem because I always have to translate the message in my forms, so this default formatting was always overwritten with a clean message. What to do? Should I report it to QF?
 [2006-09-14 20:05 UTC] wiesemann (Mark Wiesemann)
The intention in QF seems to be the following: - alignment (<td> tag) in the template - font & color in the note itself This might be inspired by the problem that there is a need for styling in the note itself because the star is colored red while the other part of the note (= the message) has the default color. In the Tableless renderer there is the same problem, the star needs special styling (not in every form, of course, but at least to emulate the default renderer). One could say that it is a QF problem that should be fixed there. But I don't think that they will do that for the 3.2.x release, as this would be a bigger change for QF and the QF users. Maybe that's something that should be noted as a HTML_QuickForm2 request or in the wiki (there should be a link on the QF2 page on pear.php.net). I think that we should try to find a solution only for the Tableless renderer. My idea: - move the font-size definition into the new div.qf_req_note class (which is empty currently) - introduce a new class for the star (maybe qf_req_note_star or sth. like that) If the required note string is the default one (as in the current QuickForm.php), modify the output of the req. note according to the proposed changes into sth. like this: '<span class="qf_req_note_star">*</span> denotes required field' If people don't like the formatting or need to translate it (I do this most times, too), they need to take care of the styling (or non-styling in the note itself) themselves. Much text, but I hope you got my idea. Would be nice to find a good and working solution to this issue.
 [2006-09-15 03:34 UTC] eduardo593734256 at gmail dot com
I got your points, I think it is the best solution. My suggestion for the class name: "star" or "indicator" .qf_req_note .star {/* stuff */}
* denotes required field
 [2006-09-15 07:52 UTC] wiesemann (Mark Wiesemann)
.star sounds good and is also short. I'll work on it on the weekend and let you have a look on the changes before I make a new release. Thanks for your feedback.
 [2006-09-17 10:57 UTC] wiesemann (Mark Wiesemann)
Hi Eduardo, you can find the proposed changes in CVS now. I did not use the "star" class because there is a already a "required" class which is used for the stars in the element labels (and as these should be rendered the same in my opinion, there is only one class for them). Please let me know what you think of it. Regards, Mark
 [2006-09-18 05:32 UTC] eduardo593734256 at gmail dot com
Ah! Sorry, I forgot about it, been too long seeing only client validation. It's really much better and consistent. Thank you for the help and attention, I checked the new source, will update my style sheet here and wait for the release. :-)
 [2006-09-18 19:32 UTC] wiesemann (Mark Wiesemann)
The release is available. Thank you very much for your valuable comments.