FIDDLE LNK我的3选择选项。我想要做的是在文档上。Continent
将populated
为country
,然后country
上的city
加载country
然后加载time
{1}}将根据 for (int i = 0; i < helpers.size(); i++) {
String outerPkey = helpers.get(i).getHelperPkey();
String outerEmpPkey = helpers.get(i).getEmployeePkey();
String outerStart = helpers.get(i).getHelperStart();
String outerEnd = helpers.get(i).getHelperEnd();
if (outerStart == null || "".equals(outerStart)) {
errorMap.put("helperSt_" + outerPkey,
"Helper Start is required");
}
if (outerEnd == null || "".equals(outerEnd)) {
errorMap.put("helperEnd_" + outerPkey, "Helper End is required");
}
if (outerEmpPkey == null || "".equals(outerEmpPkey)) {
errorMap.put("employee_" + outerPkey, "Helper name is required");
}
if (compareDate(outerStart, outerEnd)) {
errorMap.put("helperEnd_" + outerPkey,
"Helper End should be after Helper Start.");
}
for (int j = 0; j < helpers.size(); j++) {
String innerEmpPkey = helpers.get(j).getEmployeePkey();
if (j > i && outerEmpPkey.equals(innerEmpPkey)) {
String innerStart = helpers.get(j).getHelperStart();
String innerEnd = helpers.get(j).getHelperEnd();
if (compareDate(outerStart, outerEnd)
|| compareDate(innerStart, innerEnd)) {
continue;// outer loop should take care this
}
if (compareOverlap(innerStart, innerEnd, outerStart,
outerEnd)) {
errorMap.put("helperEnd_" + outerPkey,
"Helper End should be after Helper Start1.");
}
}
}
}
加载{1}}。
当用户在文本框中键入时,我会输入文本,该值将作为选定选项显示在选择中。
答案 0 :(得分:0)
在提交按钮中单击代码,您必须在下拉列表中添加新选项,而不是更新值。所以不要这样:
$('#continentselect').val(continent);
$('#countryselect').val(country);
$('#cityselect').val(city);
试试这个:
$('#continentselect').append('<option>' + continent + '</option>');
$('#countryselect').append('<option>' + country + '</option>');
$('#cityselect').val('<option>' + city + '</option>');
此外,您需要使用文本框中新输入的值更新您的js数组,例如country
,continent
和city
。