我们使用jQuery来隐藏不相关的字段,具体取决于之前的答案。似乎某种程度上浏览器(Chrome)已设法将用户的电子邮件地址插入其中。自动填充功能已设置为关闭。字段ID和名称类似于“field-32”,甚至不像“username”或“email”。
这是我们无法控制的吗?我想可以尝试清除提交中的所有隐藏字段....但这会打破其他我需要隐藏字段的东西。
答案 0 :(得分:0)
我的建议不仅是隐藏字段,还要将它们设置为禁用(ADD SIGNATURE
)。这样他们就不会与表格的其他部分一起提交。
答案 1 :(得分:0)
您可以更改自动填充功能:
function parseObj(o){
Str = "{<br />";
var i=0;
while(i<Object.keys(o).length-1){
Str += "  "+Object.keys(o)[i]+" : "+o[Object.keys(o)[i]]+",<br />";
i++;
}
Str += "  "+Object.keys(o)[i]+" : "+o[Object.keys(o)[i]]+"<br />}";
return Str;
}
function day_schedule() {
var time_plan = [{
"lesson_start": "08:00",
"lesson_end": "09:00"
}, {
"lesson_start": "09:00",
"lesson_end": "10:00"
}, {
"lesson_start": "10:00",
"lesson_end": "11:00"
}, {
"lesson_start": "11:00",
"lesson_end": "12:00"
}, {
"lesson_start": "12:00",
"lesson_end": "13:00"
}, {
"lesson_start": "13:00",
"lesson_end": "13:30"
}, {
"lesson_start": "13:30",
"lesson_end": "14:30"
}];
var day = [{
"subject_name": "Math-1",
"lesson_start": "08:00",
"lesson_end": "09:00"
}, {
"subject_name": "Phy",
"lesson_start": "11:00",
"lesson_end": "12:00"
}, {
"subject_name": "Engl",
"lesson_start": "12:00",
"lesson_end": "13:00"
}];
empty={"
var key1 = 'lesson_start';
var key2 = 'lesson_end';
var full_day = [];
for (var d = 0; d < day.length; d++) {
var start_time = day[d].lesson_start;
var end_time = day[d].lesson_end;
for (var i = 0; i < time_plan.length; i++) {
var search_key = time_plan[i][key1] == start_time && time_plan[i][key2] == end_time;
if (search_key == true) {
document.writeln('day matched == ' + parseObj(day[d])+'<br>');
full_day.push(day[d]);
} else {
full_day.push({
lesson_start: ' ',
lesson_end: ' ',
subject_name: ' '
});
}
}
// console.log('full day', full_day.length, full_day);
}
}
day_schedule();