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

    OnBlur of one field, Set Focus on another

    Want to use XBasic function in the OnBlur event of one field to set focus on another field, based on certain conditions. I've been searching this board and Alphapedia to confusion point. If someone knows how to set focus on a field, can you give me an example and not just the syntax?

    in Access, it was so simple..... fieldname.SetFocus
    ahhhhh well
    Carol King
    Developer of Custom Homebuilders' Solutions (CHS)
    http://www.CHSBuilderSoftware.com

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

    Originally posted by kingcarol View Post
    Want to use XBasic function in the OnBlur event of one field to set focus on another field, based on certain conditions. I've been searching this board and Alphapedia to confusion point. If someone knows how to set focus on a field, can you give me an example and not just the syntax?

    in Access, it was so simple..... fieldname.SetFocus
    ahhhhh well
    Have you seen this?

    http://wiki.alphasoftware.com/Grid+C...ghlight=onblur
    TYVM :) kenn

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

    Comment


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

      Just watched it. Good stuff to know. Thanks. Although I am still wanting to know what javascript or Xbasic is used to set focus on another field.
      Carol King
      Developer of Custom Homebuilders' Solutions (CHS)
      http://www.CHSBuilderSoftware.com

      Comment


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

        Originally posted by kingcarol View Post
        Just watched it. Good stuff to know. Thanks. Although I am still wanting to know what javascript or Xbasic is used to set focus on another field.
        Another question. Are you familiar with Action Scripting? It can be used to create the code you need. Let me know and I can guide you through it.
        TYVM :) kenn

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

        Comment


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

          No, I'm not familiar with it. Tell me more.
          Carol King
          Developer of Custom Homebuilders' Solutions (CHS)
          http://www.CHSBuilderSoftware.com

          Comment


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

            Originally posted by kingcarol View Post
            No, I'm not familiar with it. Tell me more.
            Open any form to design mode on the desktop. If you create a new one, put a few fields on it.

            Open the dropdown tool bar and select the Button tool; put a button on the form. When the window pops up, select the Action Scripting radio button near the bottom. Press Next and the Press Add New Action. On the right side, press Activate an Object under the Action section. Follow the prompts.

            When done, right click on the button and select Events->OnPush. You'll see the action script you just created. Click the Convert to Xbasic action icon just to the left of the lightening bolt.

            Now, you'll see the xbasic code which is more than what's needed cuz AS created it. Copy the code and make the changes to reflect your situation. You can experiment on the form by removing some of the code until you get to the minimum needed if desired.

            I think you'll find AS will open a whole new world for you. I use it quite often to generate code and then make the changes. It's a fabulous learning tool as well as a great time saver.
            TYVM :) kenn

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

            Comment


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

              I played around with all of that, Ken. Thank you. Looks like it could give me some clues.

              I couldn't find any Xbasic action for setting focus on a field there, though.

              Have just spent last hour trying to use javascript everywhere, on button click, in javascript function, then function in button, but to no avail.

              This is what I using in my failed attempts:
              Code:
              {
              document.getElementById("fname").focus();
              }
              Carol King
              Developer of Custom Homebuilders' Solutions (CHS)
              http://www.CHSBuilderSoftware.com

              Comment


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

                Carol,

                Maybe this thread will be of help. Look at the last post. I haven't tried it but it looks promising.
                http://msgboard.alphasoftware.com/al...ht=focus+login
                Jim Coltz
                Alpha Custom Database Solutions, LLC
                A5CustomSolutions.com
                [email protected]

                Comment


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

                  This is some example code for release notes last year which may help.

                  Code:
                  var rowNumber = {grid.object}._selectedRow;
                  var ele = $('{grid.componentname}.V.R' + rowNumber + '.NAMEOFFIELDTOGETFOCUS');
                  ele.focus();

                  Comment


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

                    Just found another thread, too. Selwyn put the code needed in this thread:
                    http://msgboard.alphasoftware.com/al...ht=afterselect

                    NOTE: I tried this with the OnBlur event and got an endless loop, so I don't think that's a good idea. It could be because I was also trying to pop up an alert message which blurred the field again and again. Not sure. But when I tried this code just to see if it worked on a button, it did.
                    Code:
                    var ele = $('{grid.componentname}.V.R'+{grid.object}._selectedRow+'.FIRSTNAME').focus();
                    Carol King
                    Developer of Custom Homebuilders' Solutions (CHS)
                    http://www.CHSBuilderSoftware.com

                    Comment


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

                      It seems like the only way you could get an endless loop is if you were specifying the field name in the same fields onBlur event.
                      Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                      Comment


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

                        Just to elaborate on what I'm attempting to do:

                        Use OnBlur event to check whether a user had emptied the field and then give them message (alert) that the field cannot be blank. I want this to happen as soon as they emptied a field instead of waiting for the Submit to show the error. Then after the message I want the focus to be reset to the field that they had emptied. The code below works fine but if I put in the set focus code, it causes an endless loop, so it's not in the javascript area right now. Basically, I don't know where to put it:
                        Code:
                        function DocTitle_OnBlur as c (e as p)
                        'This function will check to see if the value in the field is empty
                        'and give the user a message that the field cannot be left empty.
                        'Would like it to ALSO move the focus back to the field using this:
                        'var ele = $('{grid.componentname}.V.R'+{grid.object}._selectedRow+'.DOCTITLE').focus();
                        	
                        	dim jscmd as c
                        	
                        	dim FieldValue as c
                        	FieldValue = e._currentRowDataNew.DocTitle
                        	
                        	If FieldValue = "" then
                        	    	    	    
                        	  	jscmd = <<%js%
                        		alert('Please enter a unique File Title.  The field cannot be left empty.');
                        		%js%
                        		
                        		DocTitle_OnBlur = jscmd
                        		
                        	end if
                        		
                        end function
                        Last edited by kingcarol; 02-27-2011, 11:34 AM.
                        Carol King
                        Developer of Custom Homebuilders' Solutions (CHS)
                        http://www.CHSBuilderSoftware.com

                        Comment


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

                          Carol,

                          Why wouldn't you use the fields validation rules for this operation?

                          Just select Require value.

                          nevermind.. I re-read what you are trying to do.
                          Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                          Comment


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

                            Yep, I already had the field validation set to Require Value. but, like you reread, I want user to know about a blank field issue long before they Submit. That's partly because some fields and their auto suggest lookups are filtered based on some values in previous fields. I don't want them to get all perplexed when getting to those lookup fields. BTW, Auto Suggest lookups make it so that most field events aren't recognized.

                            Since this is a Job Costing program, I want to figure this out. For example, there could be a JOB_CODE field in their data entry where they select a Job Code. Then later in their entry, there could be a PO Number field that looks up PO's for the selected Job Code. In the lookup, I need to display more than one field (PO number, title, amount, etc), so dropdown box doesn't work well for that. Therefore, I am stuck with auto suggest field and I wouldn't want the earlier JOB_CODE field to be blank, thus causing user confusion.
                            Carol King
                            Developer of Custom Homebuilders' Solutions (CHS)
                            http://www.CHSBuilderSoftware.com

                            Comment


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

                              OK this works in IE but does not seem to set focus back to the field in FireFox.

                              Create a div with an id of 'ErrorMessageDiv' on your grid somewhere to display the message. Put this code in the onBlur event of the field you want to validate. You may have to still use the field validate event to prevent them from saving.
                              You could expand on this by making the texbox red, text red etc. with a little more code.

                              Code:
                              var vFieldValue = this.value;
                              
                              if (vFieldValue.length == 0)
                              {
                              	this.focus();
                              	$('ErrorMessageDiv').innerHTML='Can\'t be empty';
                              }
                              else
                              {
                              	$('ErrorMessageDiv').innerHTML='';
                              }
                              Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                              Comment

                              Working...
                              X