I have two pages one is new.html and other is lead.html.So, when i clicked on submit button in new.html ,the record fields should be added to the list in lead.html. Here is my code. new.html
//form validation
function validateForm() {
var x = document.forms["myForm"]["name"].value;
var y= document.forms["myForm"]["strtd"].value;
var z= document.forms["myForm"]["sub"].value;
if (x==null || x=="") {
alert("Record name must be filled out");
return false;
}
else if (y==null || y=="") {
alert("Started Date must be filled out");
return false;
}
else if (z==null || z=="") {
alert("Submitted Date must be filled out");
return false;
}
else {
alert("New Record Created");
var listCreated = false;
//Create the listview if not created
if(!listCreated){
$("$.content").append("<ul id='list' data-role='listview' data-inset='true' > </ul>");
listCreated = true;
$("$.content").trigger("create");
}
var value = $("$.label1").val();
$("#list").append("<li>" + value +" </li>");
$("#list").listview("refresh");
var value = $("$.label2").val();
$("#list").append("<li>" + value +" </li>");
$("#list").listview("refresh");
var value = $("$.label3").val();
$("#list").append("<li>" + value +" </li>");
$("#list").listview("refresh");
}
}
</script>
</head>
<body>
<form name="myForm" type="get" onsubmit="return validateForm()" action="lead.html">
<div id="top"> New Record</div>
<div>
<h5>Record Name <input type="text" name="RecordName" id="name"></h5>
</div>
<div >
<h5>Started Date <input id="strtd" type="text" name="StartedDate"></h5>
</div>
<div>
<h5>Submitted Date <input id="sub" type="text" name="SubmitedDate"></h5>
</div><br>
<div align="center">
<input type="submit" id="submit" value="Submit" >
</div>
</form>
<div align="center">
<button id="cancel" onclick="back()">Back</button>
</div>
</body>
and my lead.html
<body id="lead">
<div id="top" align="center" > Leads </div>
<img id="back" src="./images/back_icon@2x.png" onclick="onBackKey()" >
<div>
<div data-role="page" style="margin-top:100px;" >
<div data-role="main" id="content">
<label id="label1" > </label><br>
<label id="label2"></label><br>
<label id="label3"></label>
<img id="arrow" src="./images/Arrow@2x.png" style="margin-left:250px" onclick="mylead1()">
</div>
</div>
</div>
</body>
Please help me in getting listview in lead.html.