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

Mandatory field in GRID if checkbox checked

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

    Mandatory field in GRID if checkbox checked

    Hi,

    I am trying to place a condition on a field in my GRID. I have a checkbox in the same grid. If the checkbox is checked then FIELD2 must not be blank on SUBMIT of the page.

    I cant seem to get my head around achieveing this.

    Can anyone help?

    Denis

    #2
    Re: Mandatory field in GRID if checkbox checked

    have you tried going to Validation Rules under Data Value and set your expression there?

    Comment


      #3
      Re: Mandatory field in GRID if checkbox checked

      Thanks Phil,

      I thought that might be it.

      I am trying to convert this into xbasic....

      Code:
      if "COMPLETED" = .T. then "COMPLETION_NOTES" Must not be empty
      COMPLETED is a logical checkbox.
      COMPLETION NOTES is a memo field.

      Can you possibly offer some help to convert this for the CUSTOM EXPRESSION in the Data Value Validation Field?

      Thanks in advance.

      Denis

      Comment


        #4
        Re: Mandatory field in GRID if checkbox checked

        I could not seem to get things to work in the validation rules. However, go to events for BeforeValidateExistingRecords and place the following.

        Code:
        function BeforeValidateExistingRecords as v (DataSubmitted as P, Args as p, PageVariables as p)
        with PageVariables
        if (DataSubmitted.completed = .t. .and isblank(DataSubmitted.COMPLETION_NOTES) then 
            Result.Cancel = .t.
            Result.ErrorHTML = "No Data In Completion Notes"
            exit function
        end if
        end with
        end function
        I have not tested this so I may have some of the formating incorrect.

        Comment


          #5
          Re: Mandatory field in GRID if checkbox checked

          Phil,

          Thanks for trying, there was a syntax error in the code which i fixed (i think). But then it came back with 'NO SUCH FIELD'. I recreated the Datasubmitted statements manually using the buit in 'INSERT' function. So i assure you the fields do exist.

          Code:
          if (DataSubmitted.completed) = .t. .and. isblank DataSubmitted.COMPLETION_NOTES) then 
              Result.Cancel = .t.
              Result.ErrorHTML = "No Data In Completion Notes"
              exit function
          end if
          Denis

          Comment


            #6
            Re: Mandatory field in GRID if checkbox checked

            for the isblank to work you need the following and you can eliminate the () around the completed field

            isblank(DataSubmitted.COMPLETION_NOTES)

            Comment


              #7
              Re: Mandatory field in GRID if checkbox checked

              Phil,

              I republished the entire database (just in case). The code now looks like this.

              Code:
              if DataSubmitted.completed = .t. .and. isblank (DataSubmitted.COMPLETION_NOTES) then 
                  Result.Cancel = .t.
                  Result.ErrorHTML = "No Data In Completion Notes"
                  exit function
              end if
              I get the following error.

              Error executing BeforeValidateExistingRecords event handler: command: if DataSubmitted.completed= .t. .and. isblank(DataSubmitted.COMPLETION_NOTES No such field

              Denis

              Comment


                #8
                Re: Mandatory field in GRID if checkbox checked

                I think isblank() might want a field, not an web page object reference. How about:

                alltrim(DataSubmitted.COMPLETION_NOTES) = "" ?
                Peter
                AlphaBase Solutions, LLC

                [email protected]
                https://www.alphabasesolutions.com


                Comment


                  #9
                  Re: Mandatory field in GRID if checkbox checked

                  Peter,

                  Thank you for attempting this. I have since changed the fields names. The code i now have is

                  Code:
                  if DataSubmitted.ACTION_STATUS = "Completed" .and. isblank(alltrim(DataSubmitted.STATUS_NOTES) = "")  
                      Result.Cancel = .t.
                      Result.ErrorHTML = "No Data In Completion Notes"
                      exit function
                  end if
                  Error executing BeforeValidateExistingRecords event handler: command: if DataSubmitted.ACTION_STATUS = "Completed" .and. isblank(alltrim(DataSubmitted Argument is incorrect data type

                  Is this what you meant?

                  Denis

                  Comment


                    #10
                    Re: Mandatory field in GRID if checkbox checked

                    Try dropping the isblank. My suggestion evaluates the object.value to null - i.e. ""
                    Peter
                    AlphaBase Solutions, LLC

                    [email protected]
                    https://www.alphabasesolutions.com


                    Comment


                      #11
                      Re: Mandatory field in GRID if checkbox checked

                      Peter,

                      Thanks again, but I made the change as you suggested and the record just saved as normal, despite 'Completed' being selected on radio button and the 'Status Notes' being empty.

                      Code:
                      function BeforeValidateExistingRecords as v (DataSubmitted as P, Args as p, PageVariables as p)
                      with PageVariables
                      if DataSubmitted.ACTION_STATUS = "Completed" .and. alltrim(DataSubmitted.STATUS_NOTES) = ""
                          Result.Cancel = .t.
                          Result.ErrorHTML = "No Data In Completion Notes"
                          exit function
                      end if
                      end with
                      end function
                      Denis

                      Comment


                        #12
                        Re: Mandatory field in GRID if checkbox checked

                        From what you have said � I take it you don�t want to actually check the box � but have it appear checked if there is something placed in the completed notes field.

                        I do this often; it allows you to alert a user to the fact that there is information in field on another page or under another tab or even linked page without them having to display it to find out.

                        You can this using either a calculated field in the table or on the fly as a calculated field in the grid.
                        If( completed_notes >��,true,false) � you get the idea.
                        Insanity: doing the same thing over and over again and expecting different results.
                        Albert Einstein, (attributed)
                        US (German-born) physicist (1879 - 1955)

                        Comment


                          #13
                          Re: Mandatory field in GRID if checkbox checked

                          Peter,

                          Sorry if i diddnt make myself clear. As i was developing the requirement changed, so the initial first description has changed later this this thread.

                          So to confirm, i have a radio button (ACTION_STATUS) with three options,

                          Accepted
                          Declined
                          Completed

                          Below the radio button, i have a Text Area Box (STATUS_NOTES).

                          So, when a user selects one of the three options in the radio button, the STATUS NOTES text area must not be blank. So basically, if you select completed, declined or accepted you MUST enter something in the Text Area also.

                          I hope this clears up any confusion i have caused.

                          Denis

                          Comment


                            #14
                            Re: Mandatory field in GRID if checkbox checked

                            You need to use a Dialog.
                            Insanity: doing the same thing over and over again and expecting different results.
                            Albert Einstein, (attributed)
                            US (German-born) physicist (1879 - 1955)

                            Comment

                            Working...
                            X