drupal 7表单验证添加类? [英] drupal 7 form validate add class?

查看:188
本文介绍了drupal 7表单验证添加类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的表单中,我创建了一个复选框
$ b $ $ p $ $ $ $ $ $ form ['existing_customer'] = array(
'#$#类型'=>'复选框',
'#title'=> t('您是现有客户吗?')
);

当我使用hook_validate验证它时,我想添加一个类到标签中?任何想法如何实现这一点?

解决方案

感谢Clive在表单验证功能中做了一个非常讨厌的工作。 b
$ b

  $ form_state ['complete form'] ['myselectbox'] ['#title'] ='< span class =privacy-error >你没有检查我< / span>'; 

它并不漂亮,但它可以工作!


In my form I create a checkbox

$form['existing_customer'] = array(
'#type' => 'checkbox',
'#title' => t('Are you an existing customer?')
);

When I validate it using hook_validate I would like to add a class to the label? Any ideas how to achieve this?

解决方案

thanks Clive did a fairly nasty work around in the form validation function

$form_state['complete form']['myselectbox']['#title'] =  '<span class="privacy-error">you did not check me</span>';

It ain't pretty but it works!

这篇关于drupal 7表单验证添加类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆