Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Notification Prompt Dialog Example</title>
- <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
- <script type="text/javascript" charset="utf-8">
- var db;
- var dbCreated = false;
- document.addEventListener("deviceready",onDeviceReady,false);
- function onDeviceReady() {
- //var fname = "null";
- //var lname = "null";
- // var age = "null";
- var username = document.getElementById("UserName").value;
- //var password ="null";
- db = window.openDatabase("RegistrationDB", "1.0", "Registration", 200000);
- if (dbCreated)
- console.log("DB created");
- else
- db.transaction(populateDB,transaction_error,populateDB_success);
- }
- function populateDB(tx) {
- alert('in populateDB');
- tx.executeSql('DROP TABLE IF EXISTS Registration');
- var sql = "CREATE TABLE IF NOT EXISTS Registration(username VARCHAR(50))";
- tx.executeSql(sql);
- //var fname = document.getElementById("username").value;
- //var lname = document.getElementById("lname").value;
- //var age = document.getElementById("age").value;
- var uname =document.getElementById("UserName").value;
- //var pwrd = document.getElementById("psw").value;
- tx.executeSql("INSERT INTO Registration (UserName) VALUES ('uname')");
- }
- function transaction_error(tx, error) {
- alert("Database Error: " + error);
- }
- function populateDB_success() {
- dbCreated = true;
- // where you want to move
- alert("Successfully inserted");
- window.location="file:///android_asset/www/Login.html";
- }
- </script>
- </head>
- <body bgcolor="black">
- <div class="container">
- <section id="content">
- <form action="">
- <h1><font color="#FFF">Registration Form</font></h1>
- <table>
- <tr><td><font color="#FFF">GivenName</font></td><td><input type="text" placeholder="GivenName" required="" id="GivenName" /></td></tr>
- <tr><td><font color="#FFF">FamilyName</font></td><td><input type="text" placeholder="FamilyName" required="" id="FamilyName" /></td></tr>
- <tr><td><font color="#FFF">MiddleName</font></td><td><input type="text" placeholder="MiddleName" required="" id="MiddleName" /></td></tr>
- <tr><td><font color="#FFF">Address1</font></td><td><input type="text" placeholder="Address1" required="" id="Address1" /></td></tr>
- <tr><td><font color="#FFF">Address2</font></td><td><input type="text" placeholder="Address2" required="" id="Address2" /></td></tr>
- <tr><td><font color="#FFF">City/Village</font></td><td><input type="text" placeholder="City/Village" required="" id="City" /></td></tr>
- <tr><td><font color="#FFF">StateProvince</font></td><td><input type="text" placeholder="StateProvince" required="" id="StateProvince" /></td></tr>
- <tr><td><font color="#FFF">Country</font></td><td><input type="text" placeholder="Country" required="" id="Country" /></td></tr>
- <tr><td><font color="#FFF">PostalCode</font></td><td><input type="text" placeholder="PostalCode" required="" id="PostalCode" /></td></tr>
- <tr><td><font color="#FFF">Age</font></td><td><input type="text" placeholder="Age" required="" id="Age" /></td></tr>
- <tr><td><font color="#FFF">BirthDate</font></td><td><input type="date" placeholder="BirthDate" required="" id="BirthDate" /></td></tr>
- <tr><td><font color="#FFF">Gender</font></td><td><input type="text" placeholder="Gender" required="" id="Gender" /></td></tr>
- <tr><td><font color="#FFF">UserName</font></td><td><input type="text" placeholder="UserName" required="" id="UserName" /></td></tr>
- <tr><td><font color="#FFF">Password</font></td><td><input type="text" placeholder="Password" required="" id="password" /></td></tr>
- </table>
- <input type="submit" value="Submit" onclick="onDeviceReady()"/>
- <input type="submit" value="Cancel"onclick="showPrompt(); return false;" />
- </form><!-- form -->
- </section><!-- content -->
- </div><!-- container -->
- </body>
- </html>
- public class HelloWorld extends CordovaActivity
- {
- @SuppressWarnings("deprecation")
- @Override
- public void onCreate(Bundle savedInstanceState)
- {
- super.setBooleanProperty("showTitle", true);
- super.onCreate(savedInstanceState);
- //super.init();
- // Set by <content src="index.html" /> in config.xml
- //super.loadUrl(Config.getStartUrl());
- //super.loadUrl("file:///android_asset/www/index.html");
- super.setIntegerProperty("splashscreen", R.drawable.splash);
- super.loadUrl("file:///android_asset/www/Registration.html", 2000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement