我在iPhone上带有引导程序的表单选择框有问题,我正在寻找解决此问题的方法。出于某种原因,当选择一个选项并且用户移动到表单下面的下一个选择框时,所选选项将清除并显示选择的0个项目,即必填字段,这将阻止用户提交表单。这只发生在移动设备上,它在桌面浏览器中运行良好。
HTML非常标准,这些选项是由PHP生成的,我使用的是Smarty模板:
<tr>
<td class="title">Industry <span class="pink">*</span></td>
<td><select class="validate3" name="industry[]" style="width:200px;height:230px;" multiple >
<option selected="selected">Select an Industry</option>
<option value="1004" >Apprenticeships</option>
<option value="1035" >Building Services</option>
<option value="1007" >Construction & Property Jobs</option>
<option value="1010" >Energy Jobs</option>
<option value="1011" >Engineering Jobs</option>
<option value="1008" >Industrial Jobs</option>
<option value="1018" >IT & Telecoms Jobs</option>
<option value="1022" >Management & Executive Jobs</option>
<option value="1023" >Manufacturing Jobs</option>
<option value="1003" >Mechanical and Electrical</option>
<option value="1026" >Motoring & Automotive Jobs</option>
<option value="1027" >Public Sector Jobs</option>
<option value="1029" >Recruitment Consultancy Jobs</option>
<option value="1033" >Temporary Work Jobs</option>
<option value="1034" >Transport & Logistics Jobs</option>
</select></td>
</tr>
<tr>
<td class="title">Job Type <span class="pink">*</span></td>
<td><select class="validate3" name="job_type[]" style="width:200px;height:70px;" multiple >
<option selected="selected">Select a Job Type</option>
<option value="1001" >Permanent</option>
<option value="1002" >Temporary</option>
</select></td>
</tr>
正如您所看到的,我选择了一个默认选项,在用户尝试更改默认选项之前不会自行清除。
这是Smarty代码,因为这是一个问题:
<select class="validate3" name="industry[]" style="width:200px;height:230px;" multiple {if !empty($error.industry)}class="required-field"{/if}>
<option selected="selected">Select an Industry</option>
{section name="z" loop=$select_industries}
<option value="{$select_industries[z].id}" {get_value field=multiplelocation selectvalue=$select_industries[z].id fieldname="industry"}>{$select_industries[z].industry}</option>
{/section}
</select>
<select class="validate3" name="job_type[]" style="width:200px;height:70px;" multiple {if !empty($error.job_type)}class="required-field"{/if}>
<option selected="selected">Select a Job Type</option>
{section name="y" loop=$select_jobtypes}
<option value="{$select_jobtypes[y].id}" {get_value field=multiplelocation selectvalue=$select_jobtypes[y].id fieldname="job_type"}>{$select_jobtypes[y].job_type}</option>
{/section}
</select>