ユーザーが自分自身に関する詳細をフォームに入力する必要があるアプリがあります。
<ul class = 'rounded'>
<li style = "color: #FFFFFF"><input type = "text" placeholder = "Name" name = "name" id = "name" autocapitalize = "on" autocorrect = "off" autocomplete = "off" style="color: #FFFFFF; background: transparent url(../.png); border: 0; font: normal 17px Helvetica; padding: 0; display: inline-block; margin-left: 0px; width: 100%; -webkit-appearance: textarea;" /></li>
<li style = "color: #FFFFFF"><input type = "email" placeholder = "Email" name = "email" id = "email" autocapitalize = "off" autocorrect = "off" autocomplete = "off" style="color: #FFFFFF; background: transparent url(../.png); border: 0; font: normal 17px Helvetica; padding: 0; display: inline-block; margin-left: 0px; width: 100%; -webkit-appearance: textarea;" /></li>
<li style = "color: #FFFFFF"><input type = "text" maxlength = "11" placeholder = "Telephone" name = "telephone" id = "telephone" style="color: #FFFFFF; background: transparent url(../.png); border: 0; font: normal 17px Helvetica; padding: 0; display: inline-block; margin-left: 0px; width: 100%; -webkit-appearance: textarea;" /></li><br>
<li>Notifications<span class = 'toggle'><input type = 'checkbox' class = 'toggle' name = 'notifications' id = 'notifications' /></span></li>
<li>Preview<span class = 'toggle'><input type = 'checkbox' class = 'toggle' name = 'preview' id = 'preview' /></span></li>
<li>Set Profession</li>
<select name = 'job' id = 'job'>
<option value = 'jobselect'>Select Profession</option>
<option value = 'job1'>Mechanical Engineer</option>
<option value = 'job2'>Software Engineer</option>
<option value = 'jobother'>Other</option>
</select>
<p style = 'font-weight: normal; color: white;'>If you chose 'Other', please specify: <input type = "text" placeholder = "Other" name = "other" id = "other" autocapitalize = "on" autocorrect = "off" autocomplete = "off" style="color: #777; background: transparent url(../.png); border: 0; font: normal 17px Helvetica; padding: 0; display: inline-block; margin-left: 0px; width: 100%; -webkit-appearance: textarea;"/></p>
</ul>
</form>
そして、それを送信するためのボタンの後に。フォームは、以下のようにコード化された .js ファイルにリンクされています
var jQT = $.jQTouch({
icon: 'kilo.png',
statusBar: 'black'
});
$('#settingsForm').submit(function() {
var formValues = {
'name' : document.getElementById('#name'),
'email' : document.getElementById('#email'),
'telephone' : document.getElementById('#telephone'),
'notifications' : document.getElementtById('#notifications'),
'preview' : document.getElementById('#preview'),
'job' : document.getElementById('#job'),
'other' : document.getElementById('#other')
};
var formValueStr = JSON.stringify(formValues);
$.cookie('SettingsCookie', formValueStr, { expires: 14 });
});
$(document).ready(function() {
var formValueStr = $.cookie('SettingsCookie');
if (formValueStr != null) {
var formValues = JSON.parse(formValuesStr);
write(formValues['#name']);
write(formValues['#email']);
write(formValues['#telephone']);
write(formValues['#notifications']);
write(formValues['#preview']);
write(formValues['#job']);
write(formValues['#other']);
}
});
しかし、何かがうまくいかず、何が原因かわかりません。フォームは想定どおりに保存されず、フィールド内の情報はそのままにしておきたいときに削除されます。どうすれば修正できますか?どんな助けでも大歓迎です