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

How to know which field sparked the "field is required" message

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

    How to know which field sparked the "field is required" message

    Good day,

    Is it possable to know which required field the user did not fill before commiting (saving) the record? I would like to take the user back to that field on the form, so they can enter a value.

    Kind regards
    George

    #2
    Re: How to know which field sparked the "field is required" message

    Is it possable to know which required field the user did not fill before commiting (saving) the record?
    Yeh..
    It is going to be blank!

    Comment


      #3
      Re: How to know which field sparked the "field is required" message

      Originally posted by G Gabriel View Post
      Yeh..
      It is going to be blank!
      A professionally (and elegantly) developed system should not only display an error message (like A5 currently does), as the programmer I believe that I should assist the user by programmatically putting the focus on the field in question.

      Regards
      George

      Comment


        #4
        Re: How to know which field sparked the "field is required" message

        OK George, let's make it simple:
        1-If a field is required, issue your custome message
        2-When the user clicks OK on your message, use a script that activate the blank field.
        That's all.

        Another easier and simpler way so you do have to go fishing for blank required fields, on those required fields, in the CanDepart event, put a script:
        if field.value=""
        ui_msg_box("Warning", "Field is required")
        field.activate()
        end if

        Comment


          #5
          Re: How to know which field sparked the "field is required" message

          AL, is it passable to intercept the current message that A5 displays, and rather display my own custom message? Or is there maybe a trigger or event which i can interrogate to handle the situation?

          Regards

          Comment


            #6
            Re: How to know which field sparked the "field is required" message

            is there maybe a trigger or event which i can interrogate to handle the situation?
            Yeh..
            Code:
            Another easier and simpler way so you do have to go fishing for blank required fields, on those required fields, in the CanDepart event, put a script:
            if field.value=""
            ui_msg_box("Warning", "Field is required") [COLOR="DarkOrchid"][B]'this is your custom message[/B][/COLOR]
            field.activate()
            end if

            Comment


              #7
              Re: How to know which field sparked the "field is required" message

              AL? Ha!

              I never use Field Rule Always required. It's a hassle during development and provides little latitude for things like what you wish to do. I always use either a field CanDepart, or Form CanSave event to do just what Gabriel (a.k.a. Al) described.
              Mike W
              __________________________
              "I rebel in at least small things to express to the world that I have not completely surrendered"

              Comment


                #8
                Re: How to know which field sparked the "field is required" message

                I'll second what Mike and G. say. I roll my own - that way I have control over what precisely is going on.

                Below is a function I wrote to handle the required field checking. The neat thing I like about it is that if you take the time to fill in the field rules descriptive name it will put that over and use it in the error message.

                So, instead of getting - "Invcnumf is required" which basically has no meaning to the end user.

                you would get.

                "The Invoice Number Field is Required"

                After the function runs it positions the cursor back to the required field for them to remedy the situation.

                Code:
                'Date Created: 29-Aug-2006 02:14:11 PM
                'Last Updated: 14-Feb-2007 07:40:47 PM
                'Created By  : Jeff
                'Updated By  : Jeff Kletrovets
                
                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=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=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


                  #9
                  Re: How to know which field sparked the "field is required" message

                  :D I appreciate the effort, and will now go and remove all those "required" field rules.

                  Kind regards
                  George

                  Comment


                    #10
                    Re: How to know which field sparked the "field is required" message

                    I have used the code below as suggested. I get the warning but Alpha still saves the record!


                    Originally posted by G Gabriel View Post
                    Yeh..
                    Code:
                    Another easier and simpler way so you do have to go fishing for blank required fields, on those required fields, in the CanDepart event, put a script:
                    if field.value=""
                    ui_msg_box("Warning", "Field is required") [COLOR="DarkOrchid"][B]'this is your custom message[/B][/COLOR]
                    field.activate()
                    end if

                    Comment


                      #11
                      Re: How to know which field sparked the "field is required" message

                      I think I found the problem. I added a "cancel()" line in the code, seems to work. Will test further. If someone could confirm this a a proper/improper action I would appreciate it.

                      Comment


                        #12
                        Re: How to know which field sparked the "field is required" message

                        Travis,
                        you must have a commit() after this code. The code does not stop after the message is closed unless you put in end.

                        in the CanDepart event, put a script:
                        Code:
                        if field.value=""
                        ui_msg_box("Warning", "Field is required")  'this is your custom message
                        field.activate()
                        [B][COLOR="Red"]end[/COLOR][/B]
                        end if
                        Mike W
                        __________________________
                        "I rebel in at least small things to express to the world that I have not completely surrendered"

                        Comment


                          #13
                          Re: How to know which field sparked the "field is required" message

                          Thanks for the information Mike!

                          Comment


                            #14
                            Re: How to know which field sparked the "field is required" message

                            George, Thanks for the suggestion:

                            Another easier and simpler way so you do have to go fishing for blank required fields, on those required fields, in the CanDepart event, put a script:
                            if field.value=""
                            ui_msg_box("Warning", "Field is required")
                            field.activate()
                            end if

                            I do have a related question for anyone. I have a form based on a set. There is an auto increment field "Company_id" that is (as of now) set to "always required" in field rules. I keep getting an error message "Field is Required: Company_Id". This is even though the field shows as filled out. I do have two embedded browses on the same form that show child records, but I have not entered data into these browses. Anyone else have an idea why I am getting the error message?

                            Thanks,

                            john

                            Comment


                              #15
                              Re: How to know which field sparked the "field is required" message

                              Hi John,
                              I do have a related question for anyone. I have a form based on a set.
                              As you are asking a new question, it is best to start a new thread.

                              This not only helps you but others following later on, when they do a search on this forum.
                              Regards
                              Keith Hubert
                              Alpha Guild Member
                              London.
                              KHDB Management Systems
                              Skype = keith.hubert


                              For your day-to-day Needs, you Need an Alpha Database!

                              Comment

                              Working...
                              X