dsfds656545 2017-05-18 12:07
浏览 31
已采纳

提交带有禁用输入的表单

I'm wondering if I can get some assistance. I have a form that I want to submit data to a database. However, I am getting an issue doing so with the following code. The select inputs are set to disabled so if nothing is selected then the form doesn't submit those fields (fields by default are still submitted blank.

<div class="form-group">
        <label for="title">
                Title
                    <span class="asteriskField">
                          *
                     </span>
        </label>
        <select id="inputtitle" name="title" class="form-control" onchange="updateReview('title');" tabindex=1 />
                    <option value="" selected disabled>Please select</option>
                    <option value="Master">Master</option>
                    <option value="Mr">Mr</option>
                    <option value="Mrs">Mrs</option>
                    <option value="Miss">Miss</option>
                    <option value="Ms">Ms</option>
                    <option value="Rev.">Rev.</option>
        </select>
</div>

Thank you.

  • 写回答

4条回答 默认 最新

  • doudou348131346 2017-05-18 12:18
    关注

    Using disabled on option in selectbox isn't good solution, because it does not force user to select option. If he does not click on selectbox, blank value will be posted.

    To force user to select option use required on selectbox, and also leave default option disabled, so he will have to choose one option.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?