Ever tried to set an error to a fieldset element in the form validate function (form_set_error function)? I tried it and it didn't work. So after some digging around form.inc I found the answer (a clean fix at that!).
Tutorial Requirements:
- Drupal 5.
- PHPTemplate based theme.
- Know how to do a quick Copy and Paste.
First you will open your form.inc file and copy the theme_fieldset() function. Next open your template.php file that can be found in your theme folder (if you are using garland /themes/garland, if your using another theme look for its folder). You will then paste the function in that template.php file and make just a few changes.
<?php
/**
* Format a group of form items.
*
* @param $element
* An associative array containing the properties of the element.
* Properties used: attributes, title, value, description, children, collapsible, collapsed
* @return
* A themed HTML string representing the form item group.
*/
function theme_fieldset($element) {
if ($element['#collapsible']) {
drupal_add_js('misc/collapse.js');
if (!isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = '';
}
$element['#attributes']['class'] .= ' collapsible';
if ($element['#collapsed']) {
$element['#attributes']['class'] .= ' collapsed';
}
}
return '<fieldset' . drupal_attributes($element['#attributes']) .'>' . ($element['#title'] ? '<legend>'. $element['#title'] .'</legend>' : '') . ($element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : '') . $element['#children'] . $element['#value'] . "</fieldset>\n";
}
?>What needs to happen is we need to override the this themable function in our theme so that we can change the way that the fieldset elements are output. This is one of Drupal's greatest assets, a simple, clean approach to overriding the standard Drupal output.
So after copying that function into your template.php file you need to make a few modifications, change the function name to "phptemplate_fieldset" and add a sinle extra line of code:
<?php
_form_set_class($element);
?>So let's put it all together and see what the function becomes:
<?php
/**
* Format a group of form items.
*
* @param $element
* An associative array containing the properties of the element.
* Properties used: attributes, title, value, description, children, collapsible, collapsed
* @return
* A themed HTML string representing the form item group.
*/
function phptemplate_fieldset($element) {
if ($element['#collapsible']) {
drupal_add_js('misc/collapse.js');
if (!isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = '';
}
$element['#attributes']['class'] .= ' collapsible';
if ($element['#collapsed']) {
$element['#attributes']['class'] .= ' collapsed';
}
}
_form_set_class($element);
return '<fieldset' . drupal_attributes($element['#attributes']) .'>' . ($element['#title'] ? '<legend>'. $element['#title'] .'</legend>' : '') . ($element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : '') . $element['#children'] . $element['#value'] . "</fieldset>\n";
}
?>Voila, you now have a .error class attached to the fieldset html element after setting a form error using the form_set_error function.







tesekkurler
tesekkurler
tesekkurler haf?z
tesekkurler haf?z
http://www.top-laptopbattery.
http://www.top-laptopbattery.com
http://www.globalbattery.co.uk
http://www.globalbattery.co.u
http://www.globalbattery.co.uk
most recommend glasses
most recommend glasses onsale
best eyeglasses online
cheap eye glasses shop
most recommend glasses onsale
best eyeglasses online
most recommend glasses
most recommend glasses onsale
best eyeglasses online
cheap eye glasses shop
most recommend glasses onsale
best eyeglasses online
thanks a lot.
thanks a lot.
you blog is great.
you blog is great.
wholesale jewelry handmade
wholesale jewelry
handmade jewelry
costume jewelry
jewelry wholesale
good page thanks very much
good page thanks very much wholesale jewelry
UGG Boots,UGGs 55 -75% Off
UGG Boots,UGGs 55 -75% Off All UGG Boots, 100% Australian Sheepskin. UGGS australia, Free Shipping! Money Back Guarantee! Buy your UGG Boots now!
[url=http://www.up2ugg.com]UG
[url=http://www.up2ugg.com]UGG Boots[/url], [url=http://www.up2ugg.com]UGGs[/url]
55 -75% Off All UGG Boots, 100% Australian Sheepskin. UGGS australia, Free Shipping! Money Back Guarantee! Buy your UGG Boots now!
UGG Boots,UGGs 55 -75% Off
UGG Boots,UGGs 55 -75% Off All UGG Boots, 100% Australian Sheepskin. UGGS australia, Free Shipping! Money Back Guarantee! Buy your UGG Boots now!
Louis Vuitton Handbagshas
Louis Vuitton Handbagshas gained and maintained its leading position over the past decades as a brand name of luxuries goods in the world fashion industry. Louis Vuitton Designer handbags symbolize both the social status and noble elegance.
InLouis Vuitton StoreSelecting and buying your own idealized LV bag in our cheap Louis Vuitton online shop. Genuine quality and discounted price LV Handbags Louis Vuitton Store
Louis Vuitton Handbagshas
Louis Vuitton Handbagshas gained and maintained its leading position over the past decades as a brand name of luxuries goods in the world fashion industry. Louis Vuitton Designer handbags symbolize both the social status and noble elegance.
InLouis Vuitton StoreSelecting and buying your own idealized LV bag in our cheap Louis Vuitton online shop. Genuine quality and discounted price LV Handbags Louis Vuitton Store
100% Australian Sheepskin.
100% Australian Sheepskin. UGGS australia, Free Shipping! Money Back Guarantee! Buy your UGG Boots now! Mission Travel
ugg boots 50-70% Off All
ugg boots 50-70% Off All Boots, 100% Original. UGGS australia, Fast Delivery! Money Back Guarantee! Buy it now!!!
UGG
Slippers
Tiffany JewelryTiffany & ; Co Silver Jewelry, 50-70% Off, Free Shopping!
ugg boots 50-70% Off All
ugg boots 50-70% Off All
Boots, 100% Original. UGGS australia, Fast Delivery! Money Back
Guarantee! Buy it now!!!
UGG
Slippers
Tiffany JewelryTiffany &
; Co Silver Jewelry, 50-70% Off, Free Shopping!
Excellent thanks admin.
Excellent thanks admin.
i like your things ,it is
i like your things ,it is cool
VERY GOOD
VERY GOOD
luxury luxury goods top
luxury
luxury goods
top brands
designer clothes
designer handbags
fashion review
vertu blog vertu replica
vertu blog vertu replica
designer handbag blog handbagsoutlet.biz blog
gucci handbagsmaster.com
designer handbags handbagsoutlet.biz
buy replica bags come here,
buy replica bags come here, our site have good replica handbags and Louis Vuitton replica ,find good replica louis vuitton handbag and replica handbag or replica handbag .please contact us .Replica Jewelry.replica bag
I like the cheap ugg boots
I like the cheap ugg boots
thank you Okey Okey
thank you
Okey
Okey Oyna
Okey Oyunu
Bedava Okey
thank you Okey Okey
thank you
Okey
Okey Oyna
Okey Oyunu
Bedava Okey
Drupal is one kind of web
Drupal is one kind of web programming language. I am interested to drupal language.
Louis Vuitton, Cheap Louis
Louis Vuitton,
Cheap Louis Vuitton,
Louis Vuitton sale,
Louis Vuitton handbags,
replica Louis Vuitton
Louis Vuitton, Cheap Louis
Louis Vuitton,
Cheap Louis Vuitton,
Louis Vuitton sale
good
good
This is very grat things. I
This is very grat things. I like very much this type of things.
jewelry,craft,antique,daily
jewelry,craft,antique,daily news online collection at Online Collector ,Tiffany Jewelry including Tiffany Necklaces,Tiffany Rings, and tiffany bracelets…
FiFind information about tiffany ,gucci ,chanel and other jewelry online shopping at online shopping ,
nd the discount gucci shoes
This is one of Drupal's
This is one of Drupal's greatest assets, a simple, clean approach to overriding the standard Drupal output.
Stationery logo design | Brochure Design | Animated Logo Design
The article is usefull for
The article is usefull for me, thanks for the great offer.
Tukang Nggame | belajar seo
replica handbags replica
replica handbags
replica bags
2009 designer Handbags
replica handbags replica
replica handbags
replica bags
2009 designer Handbags
replica handbags replica
replica handbags
replica bags
2009 designer Handbags
replica handbags replica
replica handbags
replica bags
2009 designer Handbags
????? ?????
?????
????? ??????
????? ??????
????? ??????
???
?????
????? ??????
??? ????
????? ????
????? ??????
????? ???
???????????????
???? ???????
????? ???????
???? ??????
??? ????
?????
????
???? ???????
????? ???????
???? ??????
??? ????
thanks
Thanks for
Thanks for sharing
joueraupoker
It's a cool blog! unibet
It's a cool blog!
unibet
Thank you Dostum koxp
Thank you Dostum
koxp
Thanks for the codes. I will
Thanks for the codes. I will try to modify drupal shopping template.php
What needs to happen is we
What needs to happen is we need to override the this themable function in our theme so that we can change the way that the fieldset elements are output.
Thank yoouuu
Thank yoouuu
What needs to happen is we
What needs to happen is we need to override the this themable function in our theme so that we can change the way that the fieldset elements are saol
Thanks for
Thanks for sharing
joueraupoker
Post new comment