简体   繁体   English

获取动态表单值

[英]Getting dynamic form values

Is there a way to check which like option is selected for which text box when submitted. 有没有一种方法可以检查提交时为哪个文本框选择了哪个喜欢的选项。 As shown below user may select like only for some text values. 如下所示,用户可以只为某些文本值选择。 The html tags are dynamically generated based on the object parameters html标签是根据对象参数动态生成的

for(int i = 0 ; i < object ; i++)
{
   if(obj.textbox)
<input type="tex" id="obj.id"/> <input type="checkbox" id="obj.id"+"@"/>
 else
<select> ... </select>
}

Right now what I do is assign a text "@" as shown above to the check box and after the form is submitted iterate all the checkbox items and get the selected value and split it and get the text value and append both value and like if selected, with | 现在,我要做的就是为复选框分配一个如上所示的文本“ @”,并在提交表单后,迭代所有复选框项,并获取所选的值并将其拆分并获取文本值,并同时附加值和if选择,用| symbol and send the request. 符号并发送请求。

Is there a better way to get the entered text values and check if the like option is selected for that. 是否有更好的方法来获取输入的文本值并检查是否为此选择了like选项。

This is my View Code. 这是我的查看代码。

<div  ng-repeat="filter in filters">
<div class="content-pad">
    <fieldset>
        <label for="textinputID1"><p class="lead">
            {{filter.dsply_name}}   :
            </p>
        </label>                    
        <div class="field-group" nowrap>                            
                <input ng-if="!filter.listFlag"  type="text" id='filter.atrbt_name' class="span3">
                <button type="button" class="reset-field hide-text">Reset field</button>
                <label class="checkbox" ng-if="!filter.listFlag">
                    <input id='filter.atrbt_name' type="checkbox">
                    <i class="skin"></i> <span>Like</span> 
                </label>    
        </div>
        <div class="form-row">
            <div class="row-fluid-nowrap">
                <div class="span12">
                    <select ng-if="filter.listFlag" class="mod-select span12" ng-model="filterSelectOption" ng-options="value.displayValue as value.displayValue for value in filter.listValues">
                        <option value="" selected="selected">Select an Option</option>
                    </select>
                </div>
            </div>
            </div>
    </fieldset>
</div>

绑定click事件以提交按钮,在js回调函数中,获取值并进行检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM