簡體   English   中英

如何在 PHP 中添加“只讀”選項?

[英]How to add “readonly” option in PHP?

我正在使用 Wordpress 插件 Web 2.0 現在有問題。

很多手機用戶都有一個問題,因為當他們點擊輸入框時,手機鍵盤出現並擋住了內容。

我想在輸入字段中添加一個“只讀”選項。 但是,我不知道如何在這個 PHP 代碼中添加該選項。

https://gutentagkorea.com/business-listings

也許您可以在此鏈接中看到問題。

謝謝

<div class="w2dc-col-md-12">
<?php
if ($search_form->isCategories()) {
w2dc_tax_dropdowns_menu_init($search_form->getCategoriesDropdownsMenuParams(__('Select category', 'W2DC'), __('Please select category', 'W2DC'))); 
} else { ?>
<div class="w2dc-has-feedback">
<input readonly name="what_search" value="<?php echo esc_attr($search_form->getKeywordValue()); ?>" placeholder="<?php esc_attr_e('Enter keywords', 'W2DC')?>" class="<?php if ($search_form->isKeywordsAJAX()): ?>w2dc-keywords-autocomplete<?php endif; ?> w2dc-form-control w2dc-main-search-field" autocomplete="off" />
</div>
<?php } ?> 
    public function getCategoriesDropdownsMenuParams($placeholder_category, $placeholder_category_keywords) {
        $term_id = w2dc_getSearchTermID('category-w2dc', 'categories', w2dc_getValue($this->args, 'category'));
            
        $params = array(
                'readonly'=>'true',
                'tax' => W2DC_CATEGORIES_TAX,
                'field_name' => 'categories',
                'depth' => $this->args['categories_search_level'],
                'term_id' => $term_id,
                'count' => get_option('w2dc_show_category_count_in_search'),
                'uID' => null,
                'exact_terms' => $this->args['exact_categories'],
                'hide_empty' => get_option('w2dc_hide_empty_categories'),
                'placeholder' => $placeholder_category,
        );
        if ($this->isKeywords()) {
            $params['placeholder'] = $placeholder_category_keywords;
            $params['autocomplete_field'] = 'what_search';
            $params['autocomplete_field_value'] = $this->getKeywordValue();
            $params['autocomplete_ajax'] = $this->isKeywordsAJAX();
        }
        
        return $params;
    }

嘗試這個:

<?php 
  echo form_input(array('name'=>'what_search','value'=><?php echo esc_attr($search_form->getKeywordValue()); ?>,'size'=>'6',
  'readonly'=>'true'));//Or 'readonly'=>'readonly'
?>

等等...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM