Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

On Click Time Now

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    On Click Time Now

    Hi,

    I want a on click event that fires the current time in a particular field in the detail view. This is the code that I am currently using:

    Inline Java: {grid.Object}.setValue('D','ACTUALSTART','=TIME()')

    Whenever I click the button it displays '=TIME()'. How do I change it so it displays the actual time?

    #2
    Re: On Click Time Now

    Hi

    Off the top of my head and not tested :

    =TIME() isn't valid JavaScript.

    Try to replace '=TIME()' with something a JavaScript variable primed to the time you want.

    Some browsers support

    Code:
    var currTime = new Date().now;
    Older ones might prefer

    Code:
    var currTime = new Date().getTime();
    So, something along the lines of

    Code:
    currTime = new Date().now
    {grid.Object}.setValue('D','ACTUALSTART',currTime);
    Hope that helps, or at least gets you closer.

    Phil

    Comment


      #3
      Re: On Click Time Now

      for 24 hour clock:
      Code:
      var currentTime = new Date();
      var hours = currentTime.getHours();
      var minutes = currentTime.getMinutes();
      var AMPM = hours>=12 ?'PM': 'AM';
      var fullTime = hours+":"+minutes+" "+AMPM;
      {grid.Object}.setValue('D','TIME',fullTime);
      for 12 hour clock:
      Code:
      var currentTime = new Date();
      var hours = currentTime.getHours();
      var minutes = currentTime.getMinutes();
      var AMPM = hours>=12 ?'PM': 'AM';
      hours = hours % 12;
      hours = hours ? hours: 12;
      var fullTime = hours+":"+minutes+" "+AMPM;
      {grid.Object}.setValue('D','TIME',fullTime);
      try this code.
      Last edited by GGandhi; 03-05-2014, 09:11 AM. Reason: am pm & 12 hour clock
      thanks for reading

      gandhi

      version 11 3381 - 4096
      mysql backend
      http://www.alphawebprogramming.blogspot.com
      [email protected]
      Skype:[email protected]
      1 914 924 5171

      Comment


        #4
        Re: On Click Time Now

        Any advice for DATE logic ghandhi? I want a calculated field to reflect a 1 month forward value from a known date:

        So field1 = (for ex.) 02/05/2014
        I want field2 to = 03/05/2014
        I can't figure out how this would work from December to January or any calculation including February since its 28 days.
        been working on this on my own for 2 days with no luck
        This is in a UX btw
        NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

        Comment


          #5
          Re: On Click Time Now

          I "THINK" this would work with Javascript:
          Code:
          var today = new Date();
          var dd = today.getDate();
          
          //The following +1 would give you the date today.  I think the +2 will give you next months date 
          var mm = today.getMonth()+2;
          
          var yyyy = today.getFullYear();
          
          if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm} today = mm+'/'+dd+'/'+yyyy;
          
          alert(today);

          Comment


            #6
            Re: On Click Time Now

            that does indeed work, so I guess I need to switch the var today to be the value in field1 and see what happens. This is a great code snippet!
            NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

            Comment


              #7
              Re: On Click Time Now

              oddly though I cant figure out how to set the var "today"
              equal to
              {dialog.object}.getvalue(field1) ...you know what I mean
              I tried setvalue as well
              and an arg but still being a greenhorn I am leaving out something important of course.
              NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

              Comment


                #8
                Re: On Click Time Now

                if you create a xbasic function addMonth
                and place it on the onChange event of the first date field
                with this code the second date will be a month away.
                the method {dilog.object}.getValue(name) gives you just a date and all javascript functions on it does not seem to work well.
                so here is my xbasic version

                Code:
                dim d1 as d
                	dim d2 as d
                	d1 = e.dataSubmitted.date
                	d2 = addMonths(d1,1)
                	e._set.date2.value = d2
                it needs a server call, i don't think server will complain, too many calls.

                by the way you can do this easily when you submit the data and set it in the database backend, the user need not know about the date unless you have a reason.
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment

                Working...
                X