0
誰能幫助我如何改變在Drupal的字段屬性7.讓我們說,我已經創建了一個字段名hello_test與標籤爲hello.Now我需要改變標籤併爲申請在template.php文件中我theme.Can任何人幫助我的屬性更改和設置一個字段的id屬性在Drupal 7
誰能幫助我如何改變在Drupal的字段屬性7.讓我們說,我已經創建了一個字段名hello_test與標籤爲hello.Now我需要改變標籤併爲申請在template.php文件中我theme.Can任何人幫助我的屬性更改和設置一個字段的id屬性在Drupal 7
我前幾天遇到了同樣的問題。當我設置文本字段屬性onblur和onfocus時,它不起作用。確切地說,它正在工作,但我看不到它,因爲它被profile2模塊的形式改寫。
我想你的形式改變PROFILE2模塊形式之前API負載改變API。所以被覆蓋。我通過在另一個命名空間中創建一個自定義表單來解決我的問題。
function yourCustomModuleName_form_profile2_edit_testing_candidate_form_alter(&$form, &$form_state) {
$form['profile_testing_candidate']["field_candidate_name"] = array(
"#title" => "Candidate Name",
"#type" => "textfield",
"#required" => TRUE,
"#description" => t(""),
'#default_value' => 'Given Name',
'#attributes' => array (
'onblur' => "if (this.value == '') {this.value = 'Given Name'}",
'onfocus' => "if (this.value == 'Given Name') {this.value = ''}",
),
);
$form['profile_testing_candidate']["field_candidate_family_name"] = array(
"#title" => "",
"#type" => "textfield",
"#required" => FALSE,
"#description" => t(""),
'#default_value' => 'Family Name',
'#attributes' => array (
'onblur' => "if (this.value == '') {this.value = 'Family Name'}",
'onfocus' => "if (this.value == 'Family Name') {this.value = ''}",
),
);
}