Storing newly Incremented number

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jalley06
    New Member
    • Mar 2008
    • 20

    Storing newly Incremented number

    Hi,

    I have a form on our internal intranet that has a field called Report ID. When the user clicks the print button, this number increments by one. The problem is, the newly incremented number is not stored for the next time the web page is loaded. It defaults back to 111 (which is what I currently have it set to). I'm using Sharepoint Designer 2007 but my increment function is in Javascript.

    Can someone help me and let me know what I need to do to make the newly stored number stick? Thanks.
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    When a page is loaded, the JavaScript variables' values are not retrieved, instead, the variables are washed from the memory as soon as the page is unloaded or closed.

    For your problem, you can save (and increment) the variable value in a file (or database) through the server side script and retrieve it when page loaded again.


    Regards

    Comment

    • jalley06
      New Member
      • Mar 2008
      • 20

      #3
      Originally posted by hsriat
      When a page is loaded, the JavaScript variables' values are not retrieved, instead, the variables are washed from the memory as soon as the page is unloaded or closed.

      For your problem, you can save (and increment) the variable value in a file (or database) through the server side script and retrieve it when page loaded again.


      Regards
      I don't suppose you could point me in the right direction as to how to go about doing that could you?

      Comment

      • hsriat
        Recognized Expert Top Contributor
        • Jan 2008
        • 1653

        #4
        Originally posted by jalley06
        I don't suppose you could point me in the right direction as to how to go about doing that could you?
        I pointed you in the right direction (though I didn't tell the complete code for that).
        Did you read the second line (second para)?

        Comment

        • jalley06
          New Member
          • Mar 2008
          • 20

          #5
          Originally posted by hsriat
          I pointed you in the right direction (though I didn't tell the complete code for that).
          Did you read the second line (second para)?
          If I had not read it then I would not have replied back. I don't want you to send me the code word for word, I just wanted to know where on the server I would put this "file", what kind of "file" are you talking about? How would I call it? I can't link it to a database because of the way the form has to be designed combined with the fact that I'm using Sharepoint Designer to do this with (unfortunately) .

          I am new at this so if you don't want to help me that's fine but there's no need to be rude.

          Comment

          • hsriat
            Recognized Expert Top Contributor
            • Jan 2008
            • 1653

            #6
            Originally posted by jalley06
            I am new at this so if you don't want to help me that's fine but there's no need to be rude.
            I was not being rude, I just found your reply rude.
            Well, never mind.

            For saving the file, you need a server side script (something like PHP or ASP) and I think you are not using that.
            And JavaScript doesn't have access to the file system, so that's nearly impossible with JS.

            But you can save your variable using cookies.
            But again, if cookie is deleted, your variable will be reset.

            So I would recommend it saving it in a file. If you are already using some server side script, then tell me, I can guide you in that.

            Regards,
            Harpreet

            Comment

            • jalley06
              New Member
              • Mar 2008
              • 20

              #7
              Originally posted by hsriat
              I was not being rude, I just found your reply rude.
              Well, never mind.

              For saving the file, you need a server side script (something like PHP or ASP) and I think you are not using that.
              And JavaScript doesn't have access to the file system, so that's nearly impossible with JS.

              But you can save your variable using cookies.
              But again, if cookie is deleted, your variable will be reset.

              So I would recommend it saving it in a file. If you are already using some server side script, then tell me, I can guide you in that.

              Regards,
              Harpreet
              Well I guess I mistook the tone of your message. Sorry about that.

              Anyway, I don't have any server side scripts running at the moment. I have several Javascript functions on my page (to print the page, to increment the number, and to make a running sum of two columns on the page and am currently working on a script that will email the form automatically to a certain user in our company which I'm told needs to be server side as well)

              Needless to say, I have no experience with server side scripts. I've seen several people mention php but have no idea how to start with it. Is the php.ini file something that is on the server already or do I need to get it and put it somewhere on the server? Sorry for all the basic questions but like I said, I've never dealt with this.

              It would be great if Sharepoint Designer were more intuitive about these kind of features, but sadly no. Thanks.

              Comment

              • hsriat
                Recognized Expert Top Contributor
                • Jan 2008
                • 1653

                #8
                I guess you need to start with server side scripting. Its not difficult though but the Sharepoint Designer will not let you use it (I think).

                PHP is what I would recommend.

                Find its tutorials here.


                Good Luck

                Harpreet

                Comment

                • jalley06
                  New Member
                  • Mar 2008
                  • 20

                  #9
                  Originally posted by hsriat
                  I guess you need to start with server side scripting. Its not difficult though but the Sharepoint Designer will not let you use it (I think).

                  PHP is what I would recommend.

                  Find its tutorials here.


                  Good Luck

                  Harpreet
                  Ok I have PHP already installed on the server here. The mail settings are also defined. If I use the mail() function, where would I put the syntax in my form, between the body tags? Also, how would I get the form itself to either attach itself to the email or paste itself in the email. Thanks for the link btw, it helps alot.

                  Comment

                  • hsriat
                    Recognized Expert Top Contributor
                    • Jan 2008
                    • 1653

                    #10
                    I can help you in that too, but it would be better if you ask this in the PHP forum.


                    Regards
                    Harpreet

                    Comment

                    Working...