2017-08-17 73 views
-1

我已經安裝了用於搜索塊的自定義搜索模塊。在搜索表單中有一個文本字段,其值爲,值爲,屬性爲,空值爲。這是顯示可訪問性問題,這就是爲什麼我想要刪除它。我應該爲此做些什麼。請幫忙。如何從drupal中刪除自定義搜索表單的屬性值7

任何人都可以解決這類問題。

請參閱源代碼快照。

snapshot of source code

+0

我們需要看到您的自定義php代碼,而不是您的html。我們無法幫助自定義開發,而無需查看您的代碼 – Fky

回答

0

文本字段的值屬性在theme_textfield()強行添加,所以唯一的辦法將覆蓋該功能在你的主題,並刪除的代碼位:

function YOURTHEME_textfield($variables) { 
    $element = $variables['element']; 
    $element['#attributes']['type'] = 'text'; 
    // remove value form array 
    element_set_attributes($element, array('id', 'name', 'size', 'maxlength')); 
    _form_set_class($element, array('form-text')); 

    $extra = ''; 
    if ($element['#autocomplete_path'] && !empty($element['#autocomplete_input'])) { 
    drupal_add_library('system', 'drupal.autocomplete'); 
    $element['#attributes']['class'][] = 'form-autocomplete'; 

    $attributes = array(); 
    $attributes['type'] = 'hidden'; 
    $attributes['id'] = $element['#autocomplete_input']['#id']; 
    $attributes['value'] = $element['#autocomplete_input']['#url_value']; 
    $attributes['disabled'] = 'disabled'; 
    $attributes['class'][] = 'autocomplete'; 
    $extra = '<input' . drupal_attributes($attributes) . ' />'; 
    } 

    $output = '<input' . drupal_attributes($element['#attributes']) . ' />'; 

    return $output . $extra; 
} 

希望這幫助你...

+0

謝謝,不適合我。我可以直接在include/form.inc文件中更改它。 –

+1

不要更改核心文件 – PraveenKumar

+0

好。感謝 它可以通過自定義模塊..? –

0

你可以通過使用jquery刪除它。使用下面的代碼。

$('.custom-search-box').removeAttr('value'); 

我想這可以幫助你。

相關問題