Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7661813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:38:57+00:00 2026-05-31T13:38:57+00:00

I am trying to make an Iphone application for mobile health using html5,javascript, jqtouch

  • 0

I am trying to make an Iphone application for mobile health using html5,javascript, jqtouch and phonegap. I am doing this as a school project to learn building an iPhone app using html5 jqtouch and phonegap.

I am able to create a database with pName as a column in the database table. But I am unable to populate the entire patient name list in an empty div(first pannel named patientList)in index.html.

I have made one file named index.html. This file has different pannels.
The first pannel is a patientList pannel. The second pannel is to create a new entry in a database.
Once I create a new entry in the database, the first pannel named patient list should populate all the names of the patient. My code creates a database successfully but it does not show any name of the patients(pName) in the PatientList pannel.

I am making iphone app using HTML5, CSS, JAVASCRIPT, AND JQTOUCH, AND PHONEGAP for the first time. I need your help.

My index.html looks like this

<div id="patientList">
      <div class="toolbar">
          <h1>patientList</h1>
          <a class="button slideup" href="#newEntry">+</a>
      </div>
      <ul class="edgetoedge">

          <li id="entryTemplate" class="entry" style="display:none">
              <span class="label">Label</span>

          </li>

      </ul>
  </div>
  <div id="newEntry">
      <div class="toolbar">
          <a class="button cancel" href="#">Cancel</a>
          <h1>New Patient</h1>
          <a class="button save" href="#">Save</a>

      </div>

      <br/>

       <form method="post" >
          <ul class="rounded">
              <li><input type="text" placeholder="Patient Name" 
                  name="PatientName" id="PatientName" autocapitalize="off" 
                  autocorrect="off" autocomplete="off" /></li>
          </ul>
             <a class="button add" onclick="addNewMedicine()"style="size:12">+</a> 
          </ul>
           <div id="empty" class="rounded">
           </div>
          <ul class="rounded">
              <li><input type="submit" class="submit" name="action" 
                  value="Save Entry" /></li>
          </ul>
      </form>
  </div>

My iphone.js looks like this

     var jQT = new $.jQTouch({
           });

  var db;

    $(document).ready(function(){
       $('#newEntry form').submit(createEntry);
       $('#patientList li a').click(function(){
       var nameOffset = this.id;
       sessionStorage.currentName = nameOffset; // storing the clicked patient name
       refreshEntries();
      });

   // creating a database with name PatientDataBase and which has the table named patientRecord1

   var shortName = 'patientDataBase';
    var version = '1.0';
    var displayName = 'patientDataBase';
    var maxSize = 65536;
    db = openDatabase(shortName, version, displayName, maxSize);
    db.transaction(
       function(transaction) {
          transaction.executeSql(
             'CREATE TABLE IF NOT EXISTS patientRecord1 ' +
            '  (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, ' +
            '  pName TEXT NOT NULL);'
              );
           }
        );
     });


  // Function created a new enty in the database table patientRecord1 
   function createEntry() {
         var pName = $('#PatientName').val();
         db.transaction(
         function(transaction) {
         transaction.executeSql(
         'INSERT INTO patientRecord1 (pName) VALUES (?);', 
          [pName], 
          function(){
           refreshEntries();
           jQT.goBack();
         }, 
        errorHandler
       );
     }
   );
    return false;
  }
      // this function is used to retrive the data from the table and populate in the html pannel named patientList

     function refreshEntries() {
      $('#patientList ul li:gt(0)').remove();
     db.transaction(
     function(transaction) {
          transaction.executeSql(
          'SELECT * FROM patientRecord1;', 
                 function (transaction, result) {
                 for (var i=0; i < result.rows.length; i++) {
                      var row = result.rows.item(i);
                      var newEntryRow = $('#entryTemplate').clone();
                      newEntryRow.removeAttr('id');
                      newEntryRow.removeAttr('style');
                      newEntryRow.data('entryId', row.id);
                      newEntryRow.appendTo('#patientList ul');
                     newEntryRow.find('.label').text(row.pName);
                  }
               }, 
       errorHandler
         );
     }
    ); 
   }

        function errorHandler(transaction, error) {
         alert('Oops. Error was '+error.message+' (Code '+error.code+')');
         return true;
     }

Please tell me where I am doing wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:38:58+00:00Added an answer on May 31, 2026 at 1:38 pm

    Replace your refreshEntries() function with following:

    function refreshEntries() {
        $('#patientList ul li:gt(0)').remove();
        db.transaction(
    
        function(transaction) {
            transaction.executeSql('SELECT * FROM patientRecord1;', [], function(transaction, result) {
                for (var i = 0; i < result.rows.length; i++) {
                    var row = result.rows.item(i);
                    var newEntryRow = $('#entryTemplate').clone();
                    newEntryRow.removeAttr('id');
                    newEntryRow.removeAttr('style');
                    newEntryRow.data('entryId', row.id);
                    newEntryRow.appendTo('#patientList ul');
                    newEntryRow.find('.label').text(row.pName);
                }
            }, errorHandler);
        });
    }
    

    You have missed a param array in argument of executeSql. I have put the new code in a fiddle here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make an iPhone application for mobile health using HTML5, JavaScript,
I am trying to make a multi-textured point sprite for an iphone application using
I am trying to make this landscape only iphone app. I only use this
I'm trying to make simple use of the NSNotification center inside my iPhone application,
I am Android developer and am trying to make a my first iPhone application.
I am trying to convert an openGL application to make it work for iPhone.
I am trying to make my iPhone application connect to my Webservices. I don't
I'm trying to make an iPhone/iPad application that uses VTK to visualize DICOM images
I'm a .NET developer trying to make the leap into objective-c iPhone programming. I
I'm a beginner level programmer trying to make a game app for the iphone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.