【发布时间】:2013-08-22 14:14:06
【问题描述】:
我正在使用带有 JQuery mobile 的 HTML 构建一个表单,以便可以在移动设备上使用该表单。
我通过电子邮件将表单导出为 CSV。但是,如果未选中复选框,则不会写入 CSV 文件。
我可以使用 jQuery 中的函数从选中的复选框中提取值,使用标签中的值,并将未选中的框标记为Null 或Space,以便当我将它们导入 Excel 时注意到没有检查值?
<label for="question4" class="input"> 4. What language (s) are you currently using? </label>
<fieldset data-role="controlgroup">
<legend>Multi select:</legend>
<input type="checkbox" name="checkbox-1" id="checkbox-1" class="custom" value="english"/>
<label for="checkbox-1"> English</label>
<input type="checkbox" name="checkbox-2" id="checkbox-2" class="custom" />
<label for="checkbox-2">French</label>
<input type="checkbox" name="checkbox-3" id="checkbox-3" class="custom" />
<label for="checkbox-3">Spanish</label>
<input type="checkbox" name="checkbox-4" id="checkbox-4" class="custom" />
<label for="checkbox-4">Brazilian Portuguese</label>
<input type="checkbox" name="checkbox-5" id="checkbox-5" class="custom" />
<label for="checkbox-5">Italian</label>
<input type="checkbox" name="checkbox-6" id="checkbox-6" class="custom" />
<label for="checkbox-6">German</label>
<input type="checkbox" name="checkbox-7" id="checkbox-7" class="custom" />
<label for="checkbox-7">Japanese</label>
</fieldset>
</br>
如果在 JQuery 中没有办法,那么在 PHP 中呢?由于我使用 PHP 来填充 CSV 文件。
会不会是某种形式的 if 语句:
if checkbox = yes then pull value from <label>
【问题讨论】:
标签: php javascript jquery html