将输入类型从文本更改为多选下拉列表-技能分类

时间:2018-11-04 作者:Rifat

确实需要wordpress代码的帮助。

我在表单上有一个字段,用于向帖子添加标签。问题是,任何人都可以自由输入任何内容。这将不断填充“技能”分类法。其代码为:

<div class="form-group skill-control">
<label><?php _e(\'Tags\', \'themes\');?></label>
<input type="text" class="form-control text-field skill" id="skill" placeholder="<?php _e("Enter tags", \'themes\');?>" name=""  autocomplete="off" spellcheck="false" >
<ul class="skills-list" id="skills_list"></ul>
</div>
我想要的是,它将有一个下拉多选。下拉列表将使用技能分类中的列表填充。到目前为止,我掌握的代码是:

<div class="input-group">
<label for="skill"><?php _e(\'Specialist Skills\', \'themes\');?></label>
<?php
ae_tax_dropdown(\'skill\',
array(\'attr\' => \'data-chosen-width="100%" data-chosen-disable-search="" multiple data-placeholder="\' . __("Choose tags", \'themes\') . \'"\',
\'class\' => \'chosen chosen-multi multi-tax-item required\',
\'hide_empty\' => false,
\'hierarchical\' => true,
\'id\' => \'skill\',
\'show_option_all\' => false,
)
);?>
</div>
目前,代码正在处理from,但没有在post中插入标记!当我检索帖子时,没有标签。

如果我使用前面的代码,它会将标记添加到帖子中。

请帮忙!我做错了什么?

完整代码:

if (isset($_GET[\'return_url\'])) {
    $return = $_GET[\'return_url\'];
} else {
    $return = home_url();
}
$currency_code = ae_currency_code(false);
?>
<div class="step-wrapper step-post" id="step-post">
    <form class="post-job  post et-form" id="">
        <div class="form-group clearfix">
            <div class="input-group">
                <label for="post_title" class="input-label"><?php _e(\'Let\\\'s name your request\', \'themes\');?></label>
                <input type="text" class="input-item input-full" name="post_title" value="" required>
            </div>
        </div>
        <div class="form-group row clearfix <?php echo (\'1\' == ae_get_option(\'custom_price_mode\') || is_super_admin($user_ID)) ? \'has-price-field\' : \'\'; ?>">
            <?php if (\'1\' == ae_get_option(\'custom_price_mode\') || is_super_admin($user_ID)): ?>
                <?php


?>
                <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 clearfix">
                    <div class="input-group">

                        <label for="et_budget"><?php printf(__(\'Your budget (%s)\', \'themes\'), $currency_code);?></label>
                        <input type="number" name="et_budget"  class="input-item et_budget" >

                    </div>
                </div>
            <?php endif?>

            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 delivery-area">
                <div class="input-group delivery-time">
                    <label for="time_delivery"><?php _e(\'Max time for a specialist to deliver (Day)\', \'themes\');?></label>
                    <input type="number" name="time_delivery" value="" class="input-item time-delivery" min="0">
                </div>
            </div>
            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 category-area">
                <div class="input-group">
                    <label for="job_category"><?php _e(\'Category\', \'themes\');?></label>
                    <?php
                        ae_tax_dropdown(\'job_category\',
                        array(\'attr\' => \'data-chosen-width="100%" data-chosen-disable-search=""  data-placeholder="\' . __("Choose categories", \'themes\') . \'"\',
                            \'class\' => \'chosen chosen-single tax-item required\',
                            \'hide_empty\' => false,
                            \'hierarchical\' => true,
                            \'id\' => \'job_category\',
                            \'show_option_all\' => false,
                        )
                    );?>
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="input-group">
                <label class="mb-20"><?php _e(\'Description\', \'themes\')?></label>
                <?php wp_editor(\'\', \'post_content\', ae_editor_settings());?>
            </div>
        </div>

        <div class="input-group">
            <label for="skill"><?php _e(\'Preferred Specialist Skills\', \'themes\');?></label>
            <?php
                ae_tax_dropdown(\'skill\',
                array(\'attr\' => \'data-chosen-width="100%" data-chosen-disable-search="" multiple data-placeholder="\' . __("Choose tags", \'themes\') . \'"\',
                    \'class\' => \'chosen-multi multi-tax-item required\',
                    \'hide_empty\' => false,
                    \'hierarchical\' => true,
                    \'id\' => \'skill\',
                    \'show_option_all\' => false,
                )
            );?>
        </div>

        <div class="form-group skill-control">
            <label><?php _e(\'Tags\', \'themes\');?></label>
            <input type="text" class="form-control text-field skill" id="skill" placeholder="<?php _e("Enter microjob tags", \'themes\');?>" name=""  autocomplete="off" spellcheck="false" >
            <ul class="skills-list" id="skills_list"></ul>
        </div>

        <div class="form-group">
            <button class="<?php mje_button_classes(array(\'btn-save\', \'waves-effect\', \'waves-light\'))?>" type="submit"><?php _e(\'SAVE\', \'themes\');?></button>
            <a href="<?php echo $return; ?>" class="btn-discard"><?php _e(\'DISCARD\', \'themes\');?></a>
            <input type="hidden" class="input-item post-service_nonce" name="_wpnonce" value="<?php echo de_create_nonce(\'ae-job_post-sync\'); ?>" />
            <input type="hidden" class="input-item is_submit_request" name="is_submit_request" value="1">
            <input type="hidden" class="input-item post_type" name="post_type" value="<?php echo JOB_RECRUIT;?>">
        </div>
    </form>
</div>
提前谢谢。

1 个回复
SO网友:Zeth

你的<form>-标记未定义“操作”。这是一个如何显示的示例:

<form action="/form-retrieval-page.php" method="post">
因此,当您提交表单时,什么都不会通过。

结束

相关推荐

Get woocommerce coupon code

使用woocommerce,我可以设置折扣的优惠券代码。是否可以获取用户填写的优惠券代码。我希望店主收到一封带有用户填写的优惠券代码的邮件。是否有一个钩子可以捕获优惠券代码字段数据?提前谢谢。