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

Enable button based on one field being dirty

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

    Enable button based on one field being dirty

    I want to enable a submit button based on certain fields being dirty. Not the entire dialog.

    Normally I would use the default of 'dialog.isDirty = true'.

    UX component.
    Want to enable button if certain fields are dirty.

    I'm sure this is easier than I am overthinking it.

    #2
    Re: Enable button based on one field being dirty

    Let's say the fields are:

    field1
    field2
    field3

    I have a button that I want to be enabled if only 'field1' and 'field2' are dirty. Not 'field3'.

    Comment


      #3
      Re: Enable button based on one field being dirty

      Not sure if this is the best way... but...

      Get a pointer to the controls you need to be dirty and then get the attribute value for a5isdirty.

      Code:
      var fName = {dialog.Object}.getPointer('FIRSTNAME');
      var lName = {dialog.Object}.getPointer('LASTNAME');
      
      var fnDirty = fName.attributes['a5isdirty'].value;
      var lnDirty = lName.attributes['a5isdirty'].value;
      
      if(fnDirty=='true' && lnDirty=='true'){
      	alert('all we need are Dirty');
      }else{
      	alert('not everything we need is Dirty');
      }

      Comment


        #4
        Re: Enable button based on one field being dirty

        i am not sure this is right way to do
        but you could add this in the enable expression
        Code:
        field1 != "" and field2 !=""
        that will check if there is any value entered in those fields.
        thanks for reading

        gandhi

        version 11 3381 - 4096
        mysql backend
        http://www.alphawebprogramming.blogspot.com
        [email protected]
        Skype:[email protected]
        1 914 924 5171

        Comment


          #5
          Re: Enable button based on one field being dirty

          Thanks, gandhi, but I need to check if it's dirty, not if there's a value in it.

          Comment


            #6
            Re: Enable button based on one field being dirty

            Ideally, I'm looking for what to enter in the Enable Expression on the button.

            Comment


              #7
              Re: Enable button based on one field being dirty

              This isn't working out the way I thought it might. Here's a bit of a brute force approach... but I'm not happy with it.

              Create a TextBox named testDirty and set it's client-side show/hide expression to 1=0.

              Create this function...

              Code:
              function testDirtyFields(){
              
              	debugger;
              	
              	var fName = {dialog.Object}.getPointer('FIRSTNAME');
              	var lName = {dialog.Object}.getPointer('LASTNAME');
              	
              	
              	if(fName.attributes['a5isdirty']!= undefined){
              		var fnDirty = fName.attributes['a5isdirty'].value;
              	}else{
              		var fnDirty = false;
              	}	
              	
              	if(lName.attributes['a5isdirty']!= undefined){
              		var lnDirty = lName.attributes['a5isdirty'].value;
              	}else{
              		var lnDirty = false;
              	}	
              	
              	if(fnDirty=='true' && lnDirty=='true'){
              		{dialog.Object}.setValue('testDirty','1');
              	}else{
              		{dialog.Object}.setValue('testDirty','0');
              	}
              
              }
              And then your Button Enable expression is testDirty=1

              Add this to the onChange event of the Fields you want to test... testDirtyFields();

              Each time your fields change, the function fires and checks all the fields.

              Overall, not pretty. I'm sure there's a more elegant method for doing this.
              Last edited by Davidk; 12-17-2016, 07:14 PM.

              Comment


                #8
                Re: Enable button based on one field being dirty

                It would be nice to have a

                Code:
                isDirty = true
                type of thing.

                Here's my scenario. Customer information. There's numerous tabs, numerous list controls, misc fields from a table, and a search section. All loaded together. You select a record from a list control and open with a container window. So essentially everything is contained in one UX. Can't use the typical dialog.isDirty = true because there's too much on the UX that's dirty from the getgo. Each tab has it's own 'Save' button so I want to make each tab's button not enabled unless someone changes some text in those specific fields.

                Here's a visual to kinda help. It's the 'SAVE AND STAY' buttons that I want to have NOT enabled unless some data is changed. Right now they're always enabled. Figured having them not enabled would help the user to know if it's saved.

                Screen Shot 2016-12-17 at 5.25.33 PM.png

                Comment


                  #9
                  Re: Enable button based on one field being dirty

                  What would be nice is a field1.isDirty AND field2.isDirty as an Enable expression on a button. But I don't think isDirty is available at a control level. The code I've posted will test several fields and set a test field value... which the button enable expression is based on. Closest I can get it... but it works nicely.

                  Comment


                    #10
                    Re: Enable button based on one field being dirty

                    Yeah. That's what I meant.

                    Comment


                      #11
                      Re: Enable button based on one field being dirty

                      I figured out using your testDirty field with the enable expression on the button, but instead of the Javascript, put
                      Code:
                      {dialog.Object}.setValue("testDirty","1");
                      in the onKeyPress event instead of onChange to set the value of the testDirty field. onChange waits until you exit the field to make the change. onKeyPress fires as soon as you type something in the field. And this way I don't have to modify the javascript each time I add a field.

                      Correct me if I'm wrong on something please, though.

                      Comment


                        #12
                        Re: Enable button based on one field being dirty

                        Yup... always pick the event that best suits you. But... you get an enabled button per field now. If you're looking for an 'or' process... all good. If you're looking for an 'and' process, you won't have it.

                        Comment


                          #13
                          Re: Enable button based on one field being dirty

                          Yes, i want enabled if any field is dirty, not all. Got it working great. Thanks!

                          Comment


                            #14
                            Re: Enable button based on one field being dirty

                            Yeah... that would have been much easier. I thought you wanted field1 and field2 but not field3. Both field1 AND field2 had to be dirty, but you didn't want to check field3. Anyway... glad it's working... and still good to know about a5isdirty.

                            Comment


                              #15
                              Re: Enable button based on one field being dirty

                              instead of checking to see if the a5isdirty custom property of the control why not just change testDirty control value to 1 on the keyPress event, like
                              {dialog.object}.setValue('TESTDIRTY',1)
                              this can be on any number of fields and any one changes then it is still dirty.

                              if you run your dialog in chrome and watch the change, a5isdirty field does change but the dialogwatch function cannot watch that property since it is not a system property. in order to do you have to do what david has done. but you really don't need that much javascript code to do that, in my humble opinion. if find a way to create a system variable i will pass that along.
                              in any case, glad you found the solution.
                              thanks for reading

                              gandhi

                              version 11 3381 - 4096
                              mysql backend
                              http://www.alphawebprogramming.blogspot.com
                              [email protected]
                              Skype:[email protected]
                              1 914 924 5171

                              Comment

                              Working...
                              X