形式输出“值”是不正确的? [英] Form output "values" are not correct?

查看:179
本文介绍了形式输出“值”是不正确的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这与前一个问题相关( DIV隐藏 ;当更改下拉值时)帮助我修复了问题的一部分,但是我现在有2个问题来修复和完成这个表单。


  1. 如果我不添加访客票,则不需要付款方式 - 包含这些字段的div目前只是隐藏,但如果不需要付款,如何删除必填组件? / p>


  2. 宾客票值的编号从0到10,所以现在当客票上提交表单时,NONE表示提交表单的电子邮件


这里是最新的JSFIDDLE = http://jsfiddle.net/4REan/1/



HMTL的代码片段在这里:

 < div class =clear 
< label for =CAT_Custom_266143>会员门票:< span class =req> *< / span>< / label>
< select style =width:120px; name =CAT_Custom_266143id =CAT_Custom_266143class =cat_dropdown>
< option value => - 请选择 - < / option>
< option value =None> NONE< / option>
< option value =1 Ticket> 1 Ticket = $ 0< / option>
< option value =2 Tickets> 2 Tickets = $ 0< / option>
< option value =3 Tickets> 3 Tickets = $ 0< / option>
< option value =4 Tickets> 4 Tickets = $ 0< / option>
< option value =5 Tickets> 5 Tickets = $ 0< / option>
< option value =6 Tickets> 6 Tickets = $ 0< / option>
< option value =7 Tickets> 7 Tickets = $ 0< / option>
< option value =8 Tickets> 8 Tickets = $ 0< / option>
< option value =9 Tickets> 9 Tickets = $ 0< / option>
< option value =10 Tickets> 10 Tickets = $ 0< / option>
< / select>
< label for =CAT_Custom_266107>访客票:< span class =req> *< / span>< / label>
< select style =width:120px; name =CAT_Custom_266107id =CAT_Custom_266107class =cat_dropdown>
< option value =0> - 请选择 - < / option>
< option value =1> NONE< / option>
< option value =2> 1 Ticket = $ 15< / option>
< option value =3> 2 Tickets = $ 30< / option>
< option value =4> 3张票= $ 45< / option>
< option value =5> 4张票= $ 60< / option>
< option value =6> 5 Tickets = $ 75< / option>
< option value =7> 6票= $ 90< / option>
< option value =8> 7 Tickets = $ 105< / option>
< option value =9> 8 Tickets = $ 120< / option>
< option value =10> 9 Tickets = $ 135< / option>
< option value =11> 10张票= $ 150< / option>
< / select>
< / div>

我想使用字母数字值,但不知道如何做到这一点,会员票不同,没有额外的coed链接到此字段。



我可以将值的数字0为NONE,然后为1-10当提交它正确读?我已经尝试过,但是没有在付款方式首先关闭强制选择,我不能提交表单让它工作。

解决方案

我认为您应该为请选择选项指定值0。指定1-n票证的值,并将支付方式切换函数下的条件更改为 $('#payMethod')。toggle($(this).val()> = 1); 而不是值2.



注意:我无法测试应用程序,因为这需要提交表单,这是不可能的jsfiddle 。只需尝试一次



快乐编码:)


This is in relation to a previous question (DIV "hiding" when changing dropdown value) that helped me fix one part of the problem but I now have 2 problems to fix and finalise this form.

  1. If I don't add a Guest Ticket, there is no need for the Payment Method - the div containing these fields is currently just hidden but how do I remove the mandatory component if no payment is required?

  2. The Guest Ticket values are numbered from 0-10 so now when the form is submitted with "NONE" on Guest Tickets, the email displaying the form submission is indicating Guest = 1 because None has a value of 1.

Here is the latest JSFIDDLE = http://jsfiddle.net/4REan/1/

A snippet of the HMTL is here:

        <div class="clear">
        <label for="CAT_Custom_266143">Member Tickets: <span class="req">*</span></label>
        <select style="width: 120px;" name="CAT_Custom_266143" id="CAT_Custom_266143" class="cat_dropdown">
        <option value=" ">-- Please select --</option>
        <option value="None">NONE</option>
        <option value="1 Ticket">1 Ticket = $0</option>
        <option value="2 Tickets">2 Tickets = $0</option>
        <option value="3 Tickets">3 Tickets = $0</option>
        <option value="4 Tickets">4 Tickets = $0</option>
        <option value="5 Tickets">5 Tickets = $0</option>
        <option value="6 Tickets">6 Tickets = $0</option>
        <option value="7 Tickets">7 Tickets = $0</option>
        <option value="8 Tickets">8 Tickets = $0</option>
        <option value="9 Tickets">9 Tickets = $0</option>
        <option value="10 Tickets">10 Tickets = $0</option>
        </select>
        <label for="CAT_Custom_266107">Guest Tickets: <span class="req">*</span></label>
        <select style="width: 120px;" name="CAT_Custom_266107" id="CAT_Custom_266107" class="cat_dropdown">
        <option value="0">-- Please select --</option>
        <option value="1">NONE</option>
        <option value="2">1 Ticket = $15</option>
        <option value="3">2 Tickets = $30</option>
        <option value="4">3 Tickets = $45</option>
        <option value="5">4 Tickets = $60</option>
        <option value="6">5 Tickets = $75</option>
        <option value="7">6 Tickets = $90</option>
        <option value="8">7 Tickets = $105</option>
        <option value="9">8 Tickets = $120</option>
        <option value="10">9 Tickets = $135</option>
        <option value="11">10 Tickets = $150</option>
        </select>
        </div>

I wanted to use "alphanumeric values" but not sure how to go about this, that is why the Members Tickets are different, there is no additional coed linking to this field.

Can I number the values "0" for NONE then "1-10" for the tickets so when submitted it reads correctly? I have tried this but without turning the mandatory selection off on the Payment Method first, I can't submit the form to make it work?

解决方案

I think you should specify the value 0 for 'none' and 'please select option' . specify the value for tickets from 1-n and change the condition under toggle function of payment method to $('#payMethod').toggle($(this).val() >= 1); instead of value 2.

Note :I cant test the application as this requires submission of the form and thats not possible on jsfiddle. just try this once

Happy Coding :)

这篇关于形式输出“值”是不正确的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆