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

client-side validation

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

    client-side validation

    I've spent a lot of time validating fields using XBasic but not much with the client-side (Javascript).

    I understand it and can write validation that works, but only if the user gives focus to the field (tab, mouse, etc). In the Dialog properties, I've unchecked "Only validate edited fields" and unchecked "Only validate fields whose values were changed." I've also unchecked "Submit dialog if has client-side validation errors."

    Is there something I'm missing here? Is there not a way to validate a field client-side without the user giving focus to the field in question?

    Thanks in advance...

    #2
    Re: client-side validation

    Are you using an UX component?

    Comment


      #3
      Re: client-side validation

      Yes--UX component.

      Comment


        #4
        Re: client-side validation

        You can put all of that checking when the user clicks on the save button. Build your own save button and then test all of the fields and if all is good submit.
        Last edited by lvasic; 09-30-2014, 05:26 PM.

        Comment


          #5
          Re: client-side validation

          I assumed I could do that but it seems like a lot of work for functionality that should ideally be built in. Particularly with the offline push--all the useful validation for that has to be client-side. Oh well. Thanks.

          Comment


            #6
            Re: client-side validation

            Is there something I'm missing here? Is there not a way to validate a field client-side without the user giving focus to the field in question?
            You can use onBlur or onChange or whatever events in the "Javascript" sections relating to say fieldA and do whatever you like in there, including changing data in other fields. For example you may onBlur of a DOB field calculate and set the Age in a different field with {dialog.object}.setValue() .

            Comment


              #7
              Re: client-side validation

              Thanks Garry. My concern is that it appears the validation check is only triggered when I give focus to the field.

              So say I have 5 fields on my UX, all with client-side validation rules requiring a value be entered. When the UX is opened, focus is on the first field. My user enters valid information, then uses her mouse to (skip over fields 2 through 4 and) click on the fifth field, where she puts valid info. She clicks save, and the validation rules for questions 2 through 4 never fire. Her record saved successfully but bypassed my validation rules for questions 2 through 4.

              Comment


                #8
                Re: client-side validation

                I suggest you make a new ux and put on 4 fields and set the rules then run. It should raise errors on required fields with no data entered, This will at least prove that things work as they should. I use the client side rules frequently and they do work as required with the specified events. You do not need to give focus to fields if you program accordingly.
                Then the question is why your existing UX is not working as expected. I have experienced unexpected beaviour on UX that I have made countless changes and somehow managed to corrupt or put in some Javascript that later becomes obsolete.
                As an aside xbasic validation needs to be re-entered when you change the name of the field. You delete all existing code, save and re-open then put in code again. If you look closely you can change the code to reflect the new name but this is not your problem at present from what you describe.
                Last edited by Garry Flanigan; 10-01-2014, 05:29 AM.

                Comment


                  #9
                  Re: client-side validation

                  Thanks again Garry.

                  I'm just not seeing the same behavior you're suggesting you're seeing. I've attached a simple new dialog built like you've suggested. I'd love to know if it behaves differently for you.
                  Attached Files

                  Comment


                    #10
                    Re: client-side validation

                    See attached. Look at "Validation rules" - is this what you wanted?
                    Attached Files

                    Comment


                      #11
                      Re: client-side validation

                      Thanks Garry.

                      I'm trying to avoid server callbacks which are occurring in the component you returned. I'm building for a low bandwidth environment so trying to and the validations you provided wouldn't work at all in an offline mode because they require a connection to a server.

                      Thanks for your help anyway, though.

                      Comment


                        #12
                        Re: client-side validation

                        ok, I see what you mean.
                        What about:

                        var ans1 = {dialog.object}.getValue('Q1');
                        var n = ans1.length;
                        if (n==0){
                        alert('q1 is required');
                        } else {
                        {dialog.object}.submit();
                        }
                        as code in dialog submit click event? If this is ok, just add in all the other conditions, but still have the other field validation to assist user when they click into field. Brute force can also disable submit until all conditions are met.
                        But what I suggested at least avoids a trip to the server, unless I am still seeing it wrong.
                        Last edited by Garry Flanigan; 10-02-2014, 06:13 PM.

                        Comment


                          #13
                          Re: client-side validation

                          take a look at this screencast:
                          http://screencast.com/t/yqdEqPemn0

                          while I used only to check empty fields you can do other validation as well.
                          Last edited by GGandhi; 10-02-2014, 07:44 PM.
                          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


                            #14
                            Re: client-side validation

                            Appreciate your comments, Garry and Govindan. I guess I'm being whiny and stubborn--I'm just trying to find a way to:
                            1) Have the immediate validation fire when a user does enter bad data in the field and display beside the field;
                            2) On submit, fire for each field and errors display beside the field (just like immediate validation);
                            3) only have to write the validation rules in one place.

                            It just really seems like I could do something to fire off those validation checks at the field level even if the user doesn't touch them. I experimented with:
                            Code:
                            {dialog.Object}.setFocus('Q1');
                            {dialog.Object}.setFocus('Q2');
                            {dialog.Object}.setFocus('Q3');
                            {dialog.Object}.setFocus('Q4');
                            While that causes each field to run validation checks and responds with errors, you can't put it in the submit button code or the canSubmitDialog code because the submission goes through before those validation checks complete and would have prevented the submission.

                            I spent a little while this afternoon in Firebug trying to figure out what fires when the user touches the field and then the validation rules fire, but whether it's an onBlur event in the field or some kind of watch event elsewhere in the code, I can't find it. If I could, I think I call those functions from canSubmitDialog and catch the error prior to submitting the form.

                            I'm just convinced at this point that with all the need for client-side-only validation options on offline devices, the functionality shouldn't be so difficult...

                            Any other JS gurus out there with ideas?

                            Comment

                            Working...
                            X