Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.53 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Notification Prompt Dialog Example</title>
  5. <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
  6. <script type="text/javascript" charset="utf-8">
  7. var db;
  8. var dbCreated = false;
  9. document.addEventListener("deviceready",onDeviceReady,false);
  10. function onDeviceReady() {
  11.  
  12. //var fname = "null";
  13. //var lname = "null";
  14. // var age = "null";
  15. var username = document.getElementById("UserName").value;
  16. //var password ="null";
  17.  
  18. db = window.openDatabase("RegistrationDB", "1.0", "Registration", 200000);
  19. if (dbCreated)
  20. console.log("DB created");
  21. else
  22. db.transaction(populateDB,transaction_error,populateDB_success);
  23. }
  24.  
  25. function populateDB(tx) {
  26. alert('in populateDB');
  27. tx.executeSql('DROP TABLE IF EXISTS Registration');
  28. var sql = "CREATE TABLE IF NOT EXISTS Registration(username VARCHAR(50))";
  29. tx.executeSql(sql);
  30. //var fname = document.getElementById("username").value;
  31. //var lname = document.getElementById("lname").value;
  32. //var age = document.getElementById("age").value;
  33. var uname =document.getElementById("UserName").value;
  34. //var pwrd = document.getElementById("psw").value;
  35. tx.executeSql("INSERT INTO Registration (UserName) VALUES ('uname')");
  36.  
  37. }
  38.  
  39. function transaction_error(tx, error) {
  40. alert("Database Error: " + error);
  41. }
  42.  
  43.  
  44.  
  45. function populateDB_success() {
  46. dbCreated = true;
  47.  
  48. // where you want to move
  49. alert("Successfully inserted");
  50. window.location="file:///android_asset/www/Login.html";
  51. }
  52. </script>
  53. </head>
  54.  
  55. <body bgcolor="black">
  56. <div class="container">
  57. <section id="content">
  58. <form action="">
  59. <h1><font color="#FFF">Registration Form</font></h1>
  60. <table>
  61. <tr><td><font color="#FFF">GivenName</font></td><td><input type="text" placeholder="GivenName" required="" id="GivenName" /></td></tr>
  62. <tr><td><font color="#FFF">FamilyName</font></td><td><input type="text" placeholder="FamilyName" required="" id="FamilyName" /></td></tr>
  63. <tr><td><font color="#FFF">MiddleName</font></td><td><input type="text" placeholder="MiddleName" required="" id="MiddleName" /></td></tr>
  64. <tr><td><font color="#FFF">Address1</font></td><td><input type="text" placeholder="Address1" required="" id="Address1" /></td></tr>
  65. <tr><td><font color="#FFF">Address2</font></td><td><input type="text" placeholder="Address2" required="" id="Address2" /></td></tr>
  66. <tr><td><font color="#FFF">City/Village</font></td><td><input type="text" placeholder="City/Village" required="" id="City" /></td></tr>
  67. <tr><td><font color="#FFF">StateProvince</font></td><td><input type="text" placeholder="StateProvince" required="" id="StateProvince" /></td></tr>
  68. <tr><td><font color="#FFF">Country</font></td><td><input type="text" placeholder="Country" required="" id="Country" /></td></tr>
  69. <tr><td><font color="#FFF">PostalCode</font></td><td><input type="text" placeholder="PostalCode" required="" id="PostalCode" /></td></tr>
  70. <tr><td><font color="#FFF">Age</font></td><td><input type="text" placeholder="Age" required="" id="Age" /></td></tr>
  71. <tr><td><font color="#FFF">BirthDate</font></td><td><input type="date" placeholder="BirthDate" required="" id="BirthDate" /></td></tr>
  72. <tr><td><font color="#FFF">Gender</font></td><td><input type="text" placeholder="Gender" required="" id="Gender" /></td></tr>
  73. <tr><td><font color="#FFF">UserName</font></td><td><input type="text" placeholder="UserName" required="" id="UserName" /></td></tr>
  74. <tr><td><font color="#FFF">Password</font></td><td><input type="text" placeholder="Password" required="" id="password" /></td></tr>
  75. </table>
  76. <input type="submit" value="Submit" onclick="onDeviceReady()"/>
  77. <input type="submit" value="Cancel"onclick="showPrompt(); return false;" />
  78.  
  79.  
  80. </form><!-- form -->
  81.  
  82. </section><!-- content -->
  83. </div><!-- container -->
  84. </body>
  85. </html>
  86.  
  87. public class HelloWorld extends CordovaActivity
  88. {
  89. @SuppressWarnings("deprecation")
  90. @Override
  91. public void onCreate(Bundle savedInstanceState)
  92. {
  93. super.setBooleanProperty("showTitle", true);
  94. super.onCreate(savedInstanceState);
  95. //super.init();
  96. // Set by <content src="index.html" /> in config.xml
  97. //super.loadUrl(Config.getStartUrl());
  98. //super.loadUrl("file:///android_asset/www/index.html");
  99.  
  100.  
  101.  
  102. super.setIntegerProperty("splashscreen", R.drawable.splash);
  103. super.loadUrl("file:///android_asset/www/Registration.html", 2000);
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement