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

Field validation based on checkbox

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

    Field validation based on checkbox

    I have an order entry form with 2 checkboxes, one for Ship and one for Pickup. There's a shipping address section. What I want to do is have the field requirement be active only if the Ship checkbox is checked.

    So if the order is Ship, then the shipping information is now required fields.

    Any help pointing me in the right direction would be appreciated.

    Thanks!

    #2
    Re: Field validation based on checkbox

    David, one way to accomplish this is to add a hidden field named TOGGLE. Change it to Numeric with a default value of 0.
    Then, in your checkbox OnClick event, change the value of TOGGLE to 1 as in: {dialog.Object}.setValue('TOGGLE', 1);
    Next, in the checkbox's Client Side section, enter TOGGLE = 1 as the value for the Show/Hide proerty.

    You can TOGGLE most everything in alpha this way!

    Have fun!
    Rapid Development, Training, Support
    http://data2web.network
    903-740-2549

    Comment


      #3
      Re: Field validation based on checkbox

      This will not make the fields required, simply show and hide.
      You will need to add code in the dialog.validate function to see if that checkbox is selected and the shipping information is filled in.
      If not cancel submission and pop up message saying those are required to process.
      Last edited by GGandhi; 09-17-2014, 06:33 AM.
      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: Field validation based on checkbox

        I've added this in the Validation Xbasic section of the field.


        if e.data.Ship = "true" then
        if e.data.Ship_Attention = "" then
        validate_Ship_Attention.hasError = .t.
        validate_Ship_Attention.errorText = "Ship_Attention cannot be blank."
        end if
        end if


        'Ship' is the checkbox and 'Ship_Attention' is one of the fields I want to validate. And believe it or not, it works. I would have to enter this in each field that I want to validate. And is this clean or will it cause problems down the road?

        Comment


          #5
          Re: Field validation based on checkbox

          the data entry person is an unpredictable entity, you need to control them. they will skip the fields and crush all the efforts you put in.
          do the following.
          go to clientside events, select canSubmit event and type the following code. this is if your ship or pickup field name is type and it is a character field and address, city, state, zipcode fields are defined and required if the type is ship

          Code:
          var type = {dialog.Object}.getValue('TYPE');
          var address = {dialog.Object}.getValue('ADDRESS');
          var city = {dialog.Object}.getValue('CITY');
          var state = {dialog.Object}.getValue('STATE');
          var zipcode = {dialog.Object}.getValue('ZIPCODE');
          var msg = "";
          if (type == "ship" & address == "") {
          msg = msg + "address cannot be blank";
          }
          if (type == "ship" & city == "") {
          msg = msg + "\ncity cannot be blank";
          }
          if (type == "ship" & state == "") {
          msg = msg + "\nstate cannot be blank";
          }
          if (type == "ship" & zipcode == "") {
          msg = msg + "\nzipcode cannot be blank";
          }
          if (msg != "") {
          alert(msg);
          return false;
          }
          this will popup appropriate message and prevent any saving if the required data is not present.

          take a look at this video:
          http://screencast.com/t/tLKb9jEyth7
          Last edited by GGandhi; 09-17-2014, 07:48 AM.
          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


            #6
            Re: Field validation based on checkbox

            validation.pngValidation Rules will accomplish the same as above. Just check the box "Enable Rules" and "Require Value".
            You can then check off your conditions and add your own message in "Custom Message".
            Rapid Development, Training, Support
            http://data2web.network
            903-740-2549

            Comment


              #7
              Re: Field validation based on checkbox

              Michael
              I did check that to see if this can be enabled conditionally depending on the checkbox value, did not seem to be.
              That method is to require value all the time, the method I have suggested depends on the value ship or pickup.
              Even though I can popup alert message when the fields are empty, the user needs to go to the field and then only the popup works.
              My suggested version is not dependent on the user, it simply controls them to add the required data.
              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


                #8
                Re: Field validation based on checkbox

                Perfect! Thanks Gandhi!

                My checkbox is a logical field so this is what I used.

                Code:
                var type = {dialog.Object}.getValue('SHIP');
                var firstname = {dialog.Object}.getValue('SHIP_ATTENTION');
                var lastname = {dialog.Object}.getValue('SHIPATTN_LASTNAME');
                var address = {dialog.Object}.getValue('SECSTREET');
                var city = {dialog.Object}.getValue('SECCITY');
                var state = {dialog.Object}.getValue('SECPROVINCE');
                var zipcode = {dialog.Object}.getValue('SECPOSTALCODE');
                var msg = "";
                if (type == "1" & firstname == "") {
                msg = msg + "Ship First name cannot be blank";
                }
                if (type == "1" & lastname == "") {
                msg = msg + "\nShip Last name cannot be blank";
                }
                if (type == "1" & address == "") {
                msg = msg + "\nShip Address cannot be blank";
                }
                if (type == "1" & city == "") {
                msg = msg + "\nShip City cannot be blank";
                }
                if (type == "1" & state == "") {
                msg = msg + "\nShip State cannot be blank";
                }
                if (type == "1" & zipcode == "") {
                msg = msg + "\nShip Zipcode cannot be blank";
                }
                if (msg != "") {
                alert(msg);
                return false;
                }

                Comment


                  #9
                  Re: Field validation based on checkbox

                  Good job.
                  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