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

OnBlur of one field, Set Focus on another

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

    #16
    Re: OnBlur of one field, Set Focus on another

    Carol,

    I've set up my xbasic function pretty much the same as you have. I've changed it a bit so I can get the row number in there. This does not cause a loop on my system. My field is called "Table"... thus the Table_OnBlur.

    Code:
    If FieldValue = "" then
    Table_OnBlur = "alert('Please enter a unique File Title.  The field cannot be left empty.'); $('{grid.componentName}.V.R"+e._currentRow+".TABLE_ID').focus();"
    end if

    Comment


      #17
      Re: OnBlur of one field, Set Focus on another

      Originally posted by kingcarol View Post
      I couldn't find any Xbasic action for setting focus on a field there, though.
      Hi Carol,

      I don't want to confuse your progress with this but if you click on Activate an Object, the second item from the top in the Action side (Right) of the Action Script menu window, you WILL activate an object.

      A better way to get there is to create a button on a form and select the Use Xbasic Editor radio button, click Next, Click the Launch Script Editor button and then press the genie lamp icon on the right side of the lightening bolt to bring up the Action Script genies. Once you select the Activate an Object, Select the Object Name and click Finish, the next window shows the code.

      It would have to be changed for your situation but Xbasic is Xbasic, whether it's used on the desktop or for web development. Like I said, it will have to be changed a bit but at least the basic format is there. At least it;s good for you to know how to quickly generate code.
      TYVM :) kenn

      Knowing what you can achieve will not become reality until you imagine and explore.

      Comment


        #18
        Re: OnBlur of one field, Set Focus on another

        Well, hmmmm. Have tried David's now, but I'm still getting endless loop of the pop up alert. I looked at the field to see what else I might have going on and got rid of having it in freeform, but that didn't help. Only other thing I have is a client side conditional style to turn the text red if there is a certain string in the field. Have to go meet someone for lunch now, but I'll try getting rid of that conditional style later to see if it helps.

        Also will attempt Frank's div suggestion later. Thanks to all so far.
        Carol King
        Developer of Custom Homebuilders' Solutions (CHS)
        http://www.CHSBuilderSoftware.com

        Comment


          #19
          Re: OnBlur of one field, Set Focus on another

          Carol, you should set up a small database to zip and post here so we can see what's going on.

          Comment


            #20
            Re: OnBlur of one field, Set Focus on another

            Ken, using your suggestion, I can see that the Xbasic for Activate an Object on that from for a test button I created is topparent:TestButton.activate()

            I tried putting topparent:docTitle.activate() on a button on my grid to see if it would simple set focus to the DocTitle field. I'm getting errors about argument of wrong type and unmatched variables, so I think I don't know what argument or type to pass in to the function.

            P.S. Why is there a mean smiley face in my text above?
            Last edited by Al Buchholz; 02-28-2011, 10:25 AM. Reason: changed the D to d - to make the bad man go away..... ;)
            Carol King
            Developer of Custom Homebuilders' Solutions (CHS)
            http://www.CHSBuilderSoftware.com

            Comment


              #21
              Re: OnBlur of one field, Set Focus on another

              David, is your code triggered by the OnBlur of a field named Table, and then puts the focus on another field named TABLE_ID ? I see the TABLE_ID at the end of your code line. Since I was trying to put focus back on the same field that's triggering the OnBlur, I think that's what causes the looping.

              BTW, The code below works to simply set focus on the field from a button that calls function TestSetFocus:
              Code:
              TestSetFocus = "$('{grid.componentname}.V.R'+{grid.object}._selectedRow+'.DOCTITLE').focus();"
              This code from the button pops up the alert, but does NOT set focus on the field, even though the code for setting the focus is there. I think the alert is getting in the way of setting focus:
              Code:
              TestSetFocus = "alert('Please enter a unique File Title.  The field cannot be left empty.'); $('{grid.componentname}.V.R'+{grid.object}._selectedRow+'.DOCTITLE').focus();"
              This code (with currentRow instead of selectedRow) also works to set focus, but does NOT work to set focus when following the alert.
              Code:
              TestSetFocus = "$('{grid.componentName}.V.R"+e._currentRow+".DocTitle').focus();"
              Last edited by kingcarol; 02-28-2011, 10:28 AM.
              Carol King
              Developer of Custom Homebuilders' Solutions (CHS)
              http://www.CHSBuilderSoftware.com

              Comment


                #22
                Re: OnBlur of one field, Set Focus on another

                I'm going to drop this now because I'm happy with what I've learned about how to set focus on a field. Since setting focus on the same field that calls the code with OnBlur causes an endless loop, I've decided to use StaticText to alert the user on screen. Here's a little video about that: http://screencast.com/t/M4na8ceGTa

                Thanks all! I'm moving on with much good knowledge gained here.
                Carol King
                Developer of Custom Homebuilders' Solutions (CHS)
                http://www.CHSBuilderSoftware.com

                Comment


                  #23
                  Re: OnBlur of one field, Set Focus on another

                  Hi Carol,

                  Yes, the OnBlur event is running from a grid field named Table_Id. I check for an empty field, push out the message, and set focus back to the Table_Id field. No loops here... it must be something else causing the loop.

                  Comment


                    #24
                    Re: OnBlur of one field, Set Focus on another

                    Try this JavaScript tied to the onBlur event of the field. Replace FIELDNAME with your field name.

                    Code:
                    var f_value = {grid.Object}.getValue('G','FIELDNAME',{Grid.RowNumber});
                    
                    if (f_value == ''){
                     	{Grid.object}._f_id = $('{Grid.ComponentName}.V.R{Grid.RowNumber}.FIELDNAME');
                    	alert('A value is required');
                            setTimeout('{Grid.object}._f_id.focus();',250);     
                    }
                    Bob Moore


                    Comment


                      #25
                      Re: OnBlur of one field, Set Focus on another

                      Nice... works here... thanks Bob.

                      Here's what I found regarding the loop. If I Preview, or Live Preview then I get a loop. Published and opened no loop.

                      Comment


                        #26
                        Re: OnBlur of one field, Set Focus on another

                        Nice script, Bob. I tried it in the field I was originally using, then another field that has nothing added to it, published, and I still get looping. I don't really want to spend any more time attempting it because I'd rather not leave any chance that a user could end up in that loop.

                        I havedecided that it's much simpler just to restore the old value to the field with a message to the user about it. Since I almost always have initial default values in fields, this will take care of it for me. I think I was trying to make things too complicated. Here's what I'm going with now and I'm comfortable with it:

                        Code:
                        function DocTitle_OnBlur as c (e as p)
                        'This function will check to see if the value in a field where a value is required is empty
                        'and, if so, it puts the original (old) value back in the field.
                        
                        'NOTE:  It is important that there is an initial value in the field.  Do that using Field Properties.
                        
                        'This works great if user just moves to another field.
                        'However, If user empties a field, and goes straight to submit, there will still be an error icon,
                        'because submit fires first, in that case, but by the time they try to submit a 2nd
                        'time, the old value has been supplied and it will submit.
                        'I also created a custom validation message for Required Value on the field to tell user
                        'that the old value has been supplied and to try submitting again.
                        	
                        	
                        	If e._currentRowDataNew.DocTitle = "" then
                        	
                        		e._set.DocTitle.value = e._currentRowDataOld.DocTitle
                        		
                        		DocTitle_OnBlur = "alert('The field cannot be left empty, so the original value will be restored.');"
                        		
                        	end if
                        		
                        end function
                        Carol King
                        Developer of Custom Homebuilders' Solutions (CHS)
                        http://www.CHSBuilderSoftware.com

                        Comment


                          #27
                          Re: OnBlur of one field, Set Focus on another

                          The onBlur event is a tough one to work with in this case because you could have multiple rows for new fields and if you click out of a field with an onBlur event handler in one row and into the same field on the next row the onBlur event will fire in a continuous loop as you describe. You could possibly control the behavior with some flags but it's messy.

                          I would try to stay clear of the onBlur event within an A5 grid component if presenting multiple updateable rows if possible.
                          Bob Moore


                          Comment


                            #28
                            Re: OnBlur of one field, Set Focus on another

                            That's probably why I'm not seeing this behaviour - I'm working with a Form style grid presenting just one row.

                            Comment

                            Working...
                            X