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

Always Required data entry filed rule

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

    Always Required data entry filed rule

    Some help with 'always required' filed rule. Define data entry field rules to 'always require' certain fields. In a form, when using the tab key to move between fields or when saving a record A5 traps that a required field has not been completed. But I have two questions:

    1) When saving a record that may have multiple required fields that have not been completed what is the logical sequence by which A5 traps these? I presumed it would do so either in forward or reverse defined tab order of the form. But in some cases I find that neither is the case. Does anyone know what the A5 trap sequence logic for 'always required' is?

    2) How does one go about getting A5 to trap 'always required' fields when the user is moving between fields on a form using the mouse? For example, place some fields on a form, each with an 'always required' rule attached. Keyboard tab from field to field and A5 traps the 'always required' rule. But, instead use the mouse to move between/across fields. A5 will not trap the 'always required' field rule for individual fields that don�t actually get clicked on by the mouse. Is there a way to trap this for this situation?

    #2
    Re: Always Required data entry filed rule

    A follow up on my question. I just realized that whereas A5 traps the 'always required' rule when tabbing between fields on a form it does not do so when tabbing between columns of a browse. In a browse it only traps the rule on a save. Why? Shouldn't the rule be trapped in a browse in the same manner?

    Comment


      #3
      Re: Always Required data entry filed rule

      Doug,

      Just speaking for myself here, but I've quit trying to use the field rule "Always Required Data Entry." It gets real annoying during application development, and seems to sometimes lock you in a loop that you can't get out of without rebooting.

      I just do all my data entry verification with the Save Record button that I put on the form. Seems to work a whole lot better and has the added advantage of being able to customize the message box that appears.

      Others may be using the field rule satisfactorily, but that hasn't been my experience.

      Bob Arbuthnot

      Comment


        #4
        Re: Always Required data entry filed rule

        I agree with Bob......

        Comment


          #5
          Re: Always Required data entry field rule

          Thanks for your observations. Using the save events would probably be fine for many data entry tasks, but it so far poses challenges with certain designs I am trying to deploy.

          For example, on a form with a field with 'must exist' rules and a lookup, which is itself explicitly conditioned upon the value(s) of another field, not trapping 'always required', such as when the mouse is used to move across the form, leads to bad stuff happening.

          Attached is a simple example to illustrate what I've encountered. In the attached Test.zip open the form called 'Names_test' and play around with it. This form is bound to the table called 'Names'. There are five fields in the table each with an 'always required' rule. The very first field called 'Type' also has a simple lookup to choose between two allowed values - either Owner or Vendor. The second field, 'Entity_id' also has : 1) a cross validation that requires the 'Entity_id' value must exist in either table named 'Owners' or table named 'Vendors' based on what value is contained in the 'Type' field - if the 'Type' value is Owner then it must exist in Owners, if it is Vendor it must exist in Vendors, and 2) a conditional lookup that users either the 'Owners' or 'Vendors' tables, again dependent on the value in 'Type', to allow picking a valid value for 'Entity-id'.

          The form and data entry nominally work as expected as long as a value is actually inputted into the 'Type' field. Enter or pick the value Owner or Vendor and then try: A) typing an entry into the 'Entity_id' field - if it isn't found in the related table it correctly gets trapped, or b) use the 'Entity_id' lookup and a default browse to pick a valid selection will be opened. Cool. But.... and here's where it starts to get messy.

          Try to create a new record, but don't enter anything in 'Type' (leave it empty). Instead skip it by using the mouse and clicking into the 'Entity_id' field. Notice that an 'always required' error trap is not generated. Oops. Keep going. Try using the 'Entity-id' lookup and see the nifty error that gets generated. Not exactly what I'd call an end user friendly error message; but hey at least it is trapping that it can't do the lookup (since there is no valid value in 'Type'). So, forget doing the 'Entity_id' lookup and just try entering a value using the keyboard that you know doesn't exist as an ID in either the 'Owners' or 'Vendors' tables. Now since there is no value in 'Type' then there also A5 doesn't trap for 'must exist' in either of the two tables. Uh oh. So keep going. Leave the entry just made to 'Entity-id' in place and go back and put either value Owner or value Vendor into the 'Type' field. The form now shows a valid value for 'Type' but we know the value still contained in 'Entity-id' can't be correct. Yet in this sequence A5 will not attempt to trap what is indeed known to be an invalid entry in 'Entity-Id' and A5 will permit this record to be saved with the data mismatch as long as any other required data entry is performed first. This problem can get real ugly on a much more complicated form.

          Comment


            #6
            Re: Always Required data entry filed rule

            Douglas,

            I did not open your example but I see your issue. Below is the custom required field checking function I wrote. If you fill in your field rules for the descriptive name of the fields then this function will pop up a custom message like:

            "The Customer ID Field is Required"

            instead of the standard non descript one Alpha throws out there. Although the instructions for implementing this in the header of the function talk about putting it in the on save event you could put it on the onchange or on depart event of each field you want to check. You could also put it in the save button push just to make sure of everything. What I do when I have more than one required field on a form then I just use this function multiple times in the order I want the fields checked. This function also positions the cursor at the problem field if it finds a problem.

            In any case, I think you could modify this to work how you might want since it seems you are doing some dependent type stuff based on data entered in previous fields. Just use this function in the proper events that make sense to get you where you want to go.

            Regards,

            Jeff

            Code:
            'Date Created: 29-Aug-2006 02:14:11 PM
            'Last Updated: 04-Jan-2009 03:54:44 PM
            'Created By  : Jeff
            'Updated By  : Jeff
            
            FUNCTION Reqd_Fld_Check as L (FldToCheck as C)
            	'****** Place this function in the OnPush event of the Save Button ************
            ' ****** Sample Required Field Checking - OnPush event of Save Button
            'IF Reqd_Fld_Check("empidf")=.F. then
            '	topparent:empidf.activate()
            'stop
            'end if
            ' ***** End of Sample Code for Required Field Checking
            	DIM TblReqd as P
            	DIM FldReqd as P
            	TblReqd = table.current()
            	fldreqd = TblReqd.field_get(fldtocheck)
            
            	' If table is in Enter Mode then we need to perform the check for an empty field.
            
            	SELECT
            		CASE tblreqd.mode_get() = 2
            			' ************* ENTER MODE *********** Enter Mode = 2
            			IF fldreqd.is_blank() THEN
            				' ********  Now get the Default Descrptive Name to display in the message box.
            				'This will make this function dynamic by displaying the default descriptive name in
            				'the message box.
            				'Getting field name here
            				fldlong = tblreqd.field_get(fldtocheck)
            
            				'If the table has rules get the default descriptive name which is long_name
            				IF fldlong.has_rules() THEN
            					rules = fldlong.rules_get()
            					long_name = rules.Long_Name
            				ELSE
            					long_name = "Data Entry"  'use this as default text in message box if no rules
            				END IF
            
            				' *********** End of Get Default Descriptive Name *********
            				' ***********  Now show error message box ***************
            				ui_msg_box("Required Field","The "+long_name+" field must be filled in!",UI_STOP_SYMBOL)
            				Reqd_Fld_Check = .F.
            				
            '					vcommand = "parentform:"+alltrim(FldToCheck)+".activate()"
            '				ui_msg_box("dd",vcommand)
            '				evaluate_template(vcommand)
            '				return
            '				vcommand=eval("fldtocheck+'.activate()'")
            '				evaluate_template(vcommand)
            '				return						
            '				end
            			ELSE
            				'Field has data entered so it is ok to move on
            				Reqd_Fld_Check = .T.
            
            			END IF
            
            		CASE tblreqd.mode_get() = 1
            			' ************* EDIT MODE *********** Edit Mode = 2
            			IF fldreqd.is_blank() THEN
            				' ********  Now get the Default Descrptive Name to display in the message box.
            				'This will make this function dynamic by displaying the default descriptive name in
            				'the message box.
            				fldlong = tblreqd.field_get(fldtocheck)
            
            				'If the table has rules get the default descriptive name which is long_name
            				IF fldlong.has_rules() THEN
            					rules = fldlong.rules_get()
            					long_name = rules.Long_Name
            				ELSE
            					long_name = "Data Entry"
            				END IF
            
            				' *********** End of Get Default Descriptive Name *********
            				' ***********  Now show error message box ***************
            				ui_msg_box("Required Field","The "+long_name+" field must be filled in!",UI_STOP_SYMBOL)
            				Reqd_Fld_Check = .F.
            '				vcommand = "parentform."+alltrim(FldToCheck)+".activate"
            '				ui_msg_box("dd",vcommand)
            '				evaluate_template(vcommand)
            '				end
            '				vcommand=eval("fldtocheck+'.activate()'")
            '				evaluate_template(vcommand)
            '				return
            '				end
            			ELSE
            				'Field has data so it is ok to move on
            				Reqd_Fld_Check = .T.
            
            			END IF
            
            	END SELECT
            	
            
            END FUNCTION

            Comment


              #7
              Re: Always Required data entry filed rule

              Thanks for sharing your code snippet. I will peruse it carefully for applicability to my needs when I get some time. I really appreciate your assistance. Thanks again.

              Comment

              Working...
              X