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 immediate validation JavaScript Required. NB!!!

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

    #16
    Re: Client Side immediate validation JavaScript Required. NB!!!

    Dave,

    If I do the engine validation on the "enginesize" field it does validate, however, the engine size choice is done before the class choices, which means the engine validation does not fire because it is not a field the competitor has to "click" on.

    It does however fire JUST BEFORE the form is saved after I pressed submit. How do I stop the form from being "submitted" if there is field validation errors?

    Comment


      #17
      Re: Client Side immediate validation JavaScript Required. NB!!!

      Dave, I have to apologise very very dearly for not stating that I am working with a grid and not a dialog/ux.

      Damn, plse don't shoot me.

      Comment


        #18
        Re: Client Side immediate validation JavaScript Required. NB!!!

        Dave,

        The "L" validation works perfectly thank you.

        Comment


          #19
          Re: Client Side immediate validation JavaScript Required. NB!!!

          Wow really? After looking at your screenshot example, I thought it was a dialog (UX) component. I know you mentioned Grid in one of the first two messages you posted, but I thought you made a mistake after I saw the screenshot. No problem.

          I need to take a look at the grid validation. I have been thinking dialog validation all of this time, so I may have given you some wrong information early on. It has been a while since I last worked on a grid and I don't have the validation options memorized. I need to try it out and make sure what I told you to do actually works. It sounds like some of it has worked or you figured out how to adapt it to work in a grid. If so, good job!

          Ok so the grid does allow you to submit when there are validation errors? I know the UX component does. That is why I told you early on that you may need to add similar validation on the server-side in Xbasic. Are you comfortable with Xbasic? It is much easier to learn than JavaScript if you are not already familiar with C or C++.

          Comment


            #20
            Re: Client Side immediate validation JavaScript Required. NB!!!

            Hi Dave,

            Nope, I know less about Xbasic than I know of NASA's programs, but a pointer as above will definitely assist me hugly.

            Comment


              #21
              Re: Client Side immediate validation JavaScript Required. NB!!!

              There use to be a series of videos called "SSE1 - Validating Data" but I don't see them listed now. These videos explained the various ways in which data can be validated in a grid before it is written to a database. Here are some notes that I wrote regarding these videos:

              The Validation rules in field properties has all kinds of basic and custom/complex validation options you can specify including the error if invalid data was entered. This type of validation is specific to a field and does not take other fields or rows into consideration.

              Validation Xbasic in field properties can be used if you cannot achieve what you want from the Validation rules property. Clicking on this property brings up an Xbasic code editor with a stub validation function. This code executes on the server. Both validation rules properties can be used in conjunction. You should limit the number of real-time server-side validations of fields.

              The CanUpdateRecord event is fired before the data is updated to the database. Setting the Result.Cancel to .t. cancels the update. You put your error message in Result.ErrorHTML. Some of the update checking events activate the �Insert into script�� hyperlink at the end of the interactive window which allows you to insert valid field variables into the code. It can insert fields for the current row or any row on the grid (e.g., r1, r2, r3). The error message appears at the beginning of the row the user is updating rather than right next to the field like the two validation rule property errors. This event allows you to check individual fields, multiple fields on the current row, multiple fields on different rows and other complex validations. The error message will always appear as a row error though. The same validation rules in this event might also apply to the CanInsertRecord event as well.

              Another common use of the CanUpdateRecord and CanInsertRecord is modifying the data before it gets written to the database. This is a common requirement. This is data transformation rather than data validation. BeforeValidateExistingRecords is there for backward compatibility. There is nothing you can do in BeforeValidateExistingRecords that you can�t do in CanUpdateRecord or CanInsertRecord. BeforeValidateExistingRecords fires before CanUpdateRecord and can be used for transforming data. You cannot prevent the data from being updated in BeforeValidateExistingRecords or BeforeValidateNewRecords.

              Comment


                #22
                Re: Client Side immediate validation JavaScript Required. NB!!!

                Dave,

                What about clientside "canGridSubmit" Could I not enter the same, well almost the same validation code above to this option.

                Comment


                  #23
                  Re: Client Side immediate validation JavaScript Required. NB!!!

                  Nope Dave,

                  I just tested this and no reaction. The form still saves with the validation errors.

                  Comment


                    #24
                    Re: Client Side immediate validation JavaScript Required. NB!!!

                    Dave, here is the code that I need to "stop" the submit for if a validation is not successful.


                    var rn = {grid.object}._selectedRow;
                    var RaceNr = {grid.object}.getValue('G','RACENR',rn);
                    var HSMinAgeN = {grid.object}.getValue('G','CLASSHIGHSCHOOLMINAGE',rn);
                    var HSMaxAgeN = {grid.object}.getValue('G','CLASSHIGHSCHOOLMAXAGE',rn);
                    var Or12MinAgeN = {grid.object}.getValue('G','OR1OR2MINAGE',rn);
                    var AgeN = {grid.object}.getValue('G','AGE',rn);
                    var OR3SilverN = {grid.object}.getValue('G','OR3SILVERMINAGE',rn);
                    var OR3SilverMaxAgeN = {grid.object}.getValue('G','OR3SILVERMAXAGE',rn);
                    var Sex = {grid.object}.getValue('G','SEX',rn);
                    var SeniorMinAgeN = {grid.object}.getValue('G','SENIORMINAGE',rn);
                    var MasterMinAgeN = {grid.object}.getValue('G','MASTERMINAGE',rn);
                    var EngineSize = {grid.object}.getValue('G','ENGINCAPACITY',rn);
                    var Stroke = {grid.object}.getValue('G','BIKESTROKE',rn);
                    var SPrimClass = {grid.object}.getValue('G','PRIMARYCLASS',rn);



                    /* OR1 & OR2 Age & Engin Class validation */
                    if(SPrimClass == 'OR1' || SPrimClass == 'OR2')
                    {
                    if(AgeN < Or12MinAgeN)
                    {
                    return 'You must be older than 18 for Class OR1 & OR2';
                    }
                    }

                    /* OR3 & Silver Class validation */
                    if(SPrimClass == 'OR3' || SPrimClass == 'Silver')
                    {
                    if(AgeN < OR3SilverN || AgeN > OR3SilverMaxAgeN)
                    {
                    return 'You must be older than 16 and younger than 18 to enter OR3 & Silver class';
                    }
                    }

                    /* HighSchool Class validation */
                    if(SPrimClass == 'HighSchool')
                    {
                    if(AgeN < HSMinAgeN || AgeN >= HSMaxAgeN)
                    {
                    return 'You must be older than 14 and younger than 16 to enter HighSchool class';
                    }
                    }

                    /* Senior Class validation */
                    if(SPrimClass == 'Senior')
                    {
                    if(AgeN < SeniorMinAgeN)
                    {
                    return 'You must be older than 38 to enter Senior class';
                    }
                    }

                    /* Master Class validation */
                    if(SPrimClass == 'Master')
                    {
                    if(AgeN < MasterMinAgeN)
                    {
                    return 'You must be older than 46 to enter Master class';
                    }
                    }

                    /* Ladies Class validation */
                    if(SPrimClass == 'Ladies')
                    {
                    if(Sex = 'Male')
                    {
                    return 'You must be a woman to enter Ladies class - RIDING LIKE A GIRL DOES NOT QUALIFY';
                    }
                    }
                    return false;

                    Comment


                      #25
                      Re: Client Side immediate validation JavaScript Required. NB!!!

                      The validation code has to be written in Xbasic on the server side. This is actually easier to debug than Javascript. Are you familiar with the debugger command - debug(1)?

                      I'm not sure which event you are referring to by "canGridsubmit"? I don't see it listed. Edit: I was looking at the server side events and missed your comment about "client side".

                      So is all of your immediate client-side validation working properly? You just need to prevent the data from being submitted and written back to the database?
                      Last edited by DaveF; 11-13-2013, 05:23 PM.

                      Comment


                        #26
                        Re: Client Side immediate validation JavaScript Required. NB!!!

                        Sorry Cornelius, I am just not familiar enough with grids to give you the best advice. We could duplicate all of the validation code in the server-side event, but there should be a better way for aborting the update if any validation errors were found on the client-side. We can set our own flag on the client-side which would tell us if there are any validation errors and then check the flag on the server side and abort the update if the flag is set to true for validation errors. I'm just wondering if Alpha already has something built-in that does this work for us.

                        Comment


                          #27
                          Re: Client Side immediate validation JavaScript Required. NB!!!

                          Yes the clientside "canGridSubmit" should work. Is all of your Javascript code together in one area or is it in different parts of the component? If it is all together, you can create a user defined Javascript function and move all of the validation code into it. Then just call it from your validation property and the canGridSubmit. This would be better because there is no duplication of code. You won't be able to do this quite as easily if your current validation code is in more than one property.

                          Comment


                            #28
                            Re: Client Side immediate validation JavaScript Required. NB!!!

                            Dave, you're a star.

                            The code I posted is together in one grid control. There is however other controls that also have validation code.

                            Could we perhaps call assistance from somebody you know on the forum for a more easier or shorter method?

                            Comment


                              #29
                              Re: Client Side immediate validation JavaScript Required. NB!!!

                              You might try one of the people in this thread: http://msgboard.alphasoftware.com/al...idation+submit. You can contact them by clicking on their names. Or you can try submitting another post and re-phrase your question. There are many people on this forum who work a lot with updateable grids. Good luck!

                              Comment


                                #30
                                Re: Client Side immediate validation JavaScript Required. NB!!!

                                I have a totally different approach and it stems from me NOT knowing squat. Whenever I run into a problem like this I think how can I do this without writing any code?
                                I suggest you just use some show hide expressions so folks who are not old enough cannot even see the fields at all.
                                If I had 3 age groups I would just make 3 grids or something, again I am not a programmer, I am more of an inventor when it comes to solving this kind of problem.
                                I don't understand why if they say they are 13 you would even expose them to a field that they would not qualify for and then have to write code to say "um your too young, etc."

                                Especially if this is not some globally available app with thousands of users.
                                I would make 3 tabbedUI's and have them click on an age group link that directs them to the appropriate sign up forms, etc. after all you are relying on an honest answer in the first place.

                                If they can only use a certain engine in a certain race, then make that an edit combo box with a filter - that way they have to choose the ONLY correct choices.

                                Again, I say start with the logic of the application and limit the choices to what they can actually sign up for and this would eliminate writing the logic in code.
                                I would suggest using groups and permissions and in this way you can eliminate hand coding most everything.

                                Its kind of like when you sign up for a service like netflix and after you do they say aw sorry that movie is only available in japan. If you had know that prior you wouldnt have signed up but no they built their website to include ALL the movies...and NO logic to determine my origin but all hit the same database. Now if they built a grid that filtered only US available movies - now I would not be able to choose an unavailable movie....

                                I hope this gives you some hope and guidance to continue. Of course you could learn to code xbasic, there's always that - just not for me as I have realized I can't figure it out - I can however spend 6 months creating an interesting (point and click) method to direct an end user to the results they need.
                                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

                                Working...
                                X