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

Problem formatting short-time field

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

    Problem formatting short-time field

    Hi
    In my UX, I have a short-time field where i would like the user to not have to enter the : symbol in the middle while typing.
    I found this works when setting
    Code:
    time("0h:0m",<value>)
    in the "Display Format" Textbox property.
    The problem is that when i use the same ux to load data from a mySQL table, that field does not get loaded . If i remove that value from the display format property then it all works well (saves and reloads)

    Thanks
    Jaime

    Edit: tried setting it as a C field as well, same problem

    #2
    Re: Problem formatting short-time field

    I briefly investigated this. The AWS doesn't appear set the value to anything if you've set the Display Format. I inspected the return from the server in FireBug. It executes something similar to {dialog.object}.setValue('TIME_FIELD','') if you've specified a Display Format. If you don't, then the value is actually set to the time, eg: {dialog.object}.setValue('TIME_FIELD','04:00:00:00 am'). You should probably send Alpha a bug report. This looks suspiciously like a problem.

    In short term, though, you might be able to get around this a number of ways. You could certainly write a little bit of code to fetch the time and manually set the value with an ajaxCallback or server-side event (if you're populating the values in onDialogInitialize, then you'd just add some extra at the end probably.) You can leave your field an S with a Display Format and all the whistles. It should also save to the DB just fine. But loading the value will be something you have to write.

    I did have a question. If you set the Time format to "0h:0m" and then edit the time, does it save back to your database successfully? Your initial value would be the long form but the edited value would display using the hours-minutes form:
    timeFormat.png

    If your time saves back to the DB successfully with the Time Format set to your desired display format, then you could manually format the time field yourself after the data is populated with a bit of client-side sauce:
    Code:
    var timeFormat = "0h:0m";
    var d = new Date(2000,1,1);
    var val = {dialog.object}.getValue('TIME_FIELD');
    d.fromFormat(val,timeFormat);
    val = d.toFormat(timeFormat);
    {dialog.object}.setValue('TIME_FIELD', val);
    Alpha added 2 extension functions for the Date object in JavaScript:

    fromFormat([value as string], [time format])
    Sets the Date by parsing the [value as string] using the specified [time format]

    toFormat([time format])
    Returns a String representation of the Date in the format specified by [time format]

    I'm pretty 100% confident these functions are not documented on the wiki. And they're not part of the Date JavaScript spec. This is what I learned a while back, anyway.

    The time format is specified using the rules specified here: http://wiki.alphasoftware.com/Date+a...ormat+Elements

    Good luck.
    Alpha Anywhere latest pre-release

    Comment


      #3
      Re: Problem formatting short-time field

      Hi Sarah
      Thanks for taking the time...
      I did have a question. If you set the Time format to "0h:0m" and then edit the time, does it save back to your database successfully? Your initial value would be the long form but the edited value would display using the hours-minutes form:
      In this UX, i use short time fields, saved to the DB in c(5) fields. I tried setting field type in Alpha to either Character or Short-Time, didn't have any impact. I always set Time Format property to 0h:0m in all my short time fields throughout the application. When i remove the setting in the 'Display Format' it saves succesfully to the DB, and when editing the record in the DB the time fields populate successfully, but the users need the enter the : character when adding new records.
      By the way, it's really not intuitive to call this Display Format since this doesn't imply it is in fact an Input Mask...

      Alpha added 2 extension functions for the Date object in JavaScript:

      fromFormat([value as string], [time format])
      Sets the Date by parsing the [value as string] using the specified [time format]

      toFormat([time format])
      Returns a String representation of the Date in the format specified by [time format]
      <vbg> now you tell!!?!?! Been suffering for two weeks writing datetime validation functions in javascript :-) This would have save me some time...

      Jaime

      Comment


        #4
        Re: Problem formatting short-time field

        Originally posted by WindForce View Post
        <vbg> now you tell!!?!?! Been suffering for two weeks writing datetime validation functions in javascript :-) This would have save me some time...
        Ha ha. Except I posted about it a long time ago: http://msgboard.alphasoftware.com/al...at%28format%29

        I'm not sure what Alpha plans on doing with these functions down the road - they might be slightly different in Version 12, so use at your own risk. But I have used them in the onBlur event to auto-format whatever crazy stuff my users type in and it's been wildly successful. I can almost abandon the time picker completely.
        Alpha Anywhere latest pre-release

        Comment


          #5
          Re: Problem formatting short-time field

          Ha ha. Except I posted about it a long time ago: http://msgboard.alphasoftware.com/al...at%28format%29
          yeah, go ahead, "pour some salt on my wounds" as they say in Israel :-)

          Comment


            #6
            Re: Problem formatting short-time field

            Originally posted by WindForce View Post
            yeah, go ahead, "pour some salt on my wounds" as they say in Israel :-)
            Any time! Glad I could help. :P
            Alpha Anywhere latest pre-release

            Comment


              #7
              Re: Problem formatting short-time field

              i am not able to duplicate any problem.

              i tested this:

              1. mysql table with a field of type 'time'
              2. data bound UX component
              3. server side display format expression of time("0h:0m",<value>)
              4. defined an onDialogInitialize event to load primary keys

              run the component - the time field shows up perfectly and it correctly formatted.

              Comment


                #8
                Re: Problem formatting short-time field

                Selwyn
                No.1 in your list may be the key. I never use the time type in mySql for short times, i use C(5) instead. Anyway, steps sent :-)

                Jaime

                Comment


                  #9
                  Re: Problem formatting short-time field

                  well, if your field type is a character field, and not a shorttime field, then the reason that the server side format is not working is quite simple. the time() function does not operate on a character value input.

                  you would need to change your server side display format to first cast the character value to a short time value using the convert_type() function.




                  time("0h:0m am",convert_type(<value>,"Y"))
                  Last edited by Selwyn Rabins; 02-26-2014, 06:30 PM.

                  Comment

                  Working...
                  X