Results 1 to 10 of 13

Thread: [Solved] Recordset record pointer question

Threaded View

  1. #1

    [Solved] Recordset record pointer question

    Hi,

    In a jssp page, I have created a simple navigation section.
    All I am looking to do is step through a table.
    I am missing something though.

    I can MoveFirst(), MoveLast() without an issue.

    MoveNext(), MovePrior(), MoveRelative() all seem to start from the first record each time they are clicked.

    How do I keep the record pointer from resetting itself.

    Below is my very simple jssp page. I am purposely mixing the Lianja and javascript code so I can understand how they interact.

    Code:
    <%@ Language=JavaScript %>
    <html>
    <head>
    <script>
    <%
        db = Lianja.openDatabase("southwind");
        rs   = db.openRecordSet("example");
        
        
    %>
    
    
    var moveLast = function(){
        <%
        rs.moveLast();
        firstname = rs.field("FIRST_NAME").value;
        lastname = rs.field("LAST_NAME").value;
        print('document.getElementById("firstname").value = "'+firstname+'";')
        print('document.getElementById("lastname").value = "'+lastname+'";')
        
        %>
        };
        
    
    var moveFirst = function(){
        <%
        rs.moveFirst();
        firstname = rs.field("FIRST_NAME").value;
        lastname = rs.field("LAST_NAME").value;
        print('document.getElementById("firstname").value = "'+firstname+'";')
        print('document.getElementById("lastname").value = "'+lastname+'";')
        %>
        };
    
    
    var moveNext = function(){
        <%
        rs.moveNext();
        firstname = rs.field("FIRST_NAME").value;
        lastname = rs.field("LAST_NAME").value;
        print('document.getElementById("firstname").value = "'+firstname+'";')
        print('document.getElementById("lastname").value = "'+lastname+'";')
        %>
        };
    
    
    var movePrevious = function(){
        <%
        rs.movePrevious();
        firstname = rs.field("FIRST_NAME").value;
        lastname = rs.field("LAST_NAME").value;
        print('document.getElementById("firstname").value = "'+firstname+'";')
        print('document.getElementById("lastname").value = "'+lastname+'";')
        %>
        };
    
    var moveRelative= function(){
        <%
        rs.moveRelative(5);
        firstname = rs.field("FIRST_NAME").value;
        lastname = rs.field("LAST_NAME").value;
        print('document.getElementById("firstname").value = "'+firstname+'";')
        print('document.getElementById("lastname").value = "'+lastname+'";')
        %>
        };
    
    
    window.onload = function(){
    document.getElementById("btnMoveLast").onclick = moveLast;
    document.getElementById("btnMoveFirst").onclick = moveFirst;
    document.getElementById("btnMoveNext").onclick = moveNext;
    document.getElementById("btnMovePrevious").onclick = movePrevious;
    document.getElementById("btnMoveRelative").onclick = moveRelative;
    
    };
    
    
    
    </script>
    
    </head>
    
    <body>
    
    <%
    
    print('<label for ="firstname" >First Name</label>')
    print('<input type = "text" id = "firstname" >')
    print('<br>')
    print('<label for ="lastname" >Last Name</label>')
    print('<input type = "text" id = "lastname">')
    print('<br>')
    print('<label for ="recno" >Recno    </label>')
    print('<input type = "text" id = "recno">')
    print('<br>')
    %>
    <input type ="button" id = "btnMoveFirst" value ="First">
    <input type ="button" id = "btnMoveLast" value ="Last">
    <input type ="button" id = "btnMoveNext" value ="Next">
    <input type ="button" id = "btnMovePrevious" value ="Previous">
    <input type ="button" id = "btnMoveRelative" value ="Relative 5">
    
    
    </body>
    
    
    
    </html>



    The page looks like this
    Name:  jssprecno.jpg
Views: 654
Size:  19.0 KB
    Last edited by barrymavin; 2014-12-26 at 20:40.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us