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

Does setValue mark field dirty in detail view?

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

  • Does setValue mark field dirty in detail view?

    Before I go creating a test case I wanted to ask if the following behavior is to be expected: I have a read-only grid with an editable detail view (SQL). In the detail view I set the values of some controls in javascript (called in the OnChange event of certain fields). When I submit (i.e. save) the detail view it appears that the values set via javascript are NOT being saved. Via judicious debugging in the CanUpdate server-side event I find that the data submitted is correct (i.e. DataSubmitted.FieldName is as set in javascript); HOWEVER, the list of dirty fields DOES NOT include the ones set with javascript. If I manually type a value into the field then it is in the dirty field list and is saved, otherwise not.

    Now the help for setValue SEEMS to indicate that this function should set the modified field to dirty (although it actually only refers to a GRID field, not a DETAIL field), and I also could have sworn this worked before I updated to the latest AA version (4). I scanned the release notes for the new version and saw nothing about text fields in UX components called from a read-only grid, and indeed maybe this behavior was present before the update. I don't know.

    So my question is: Is this normal behavior (i.e. setValue does not mark the changed control as dirty)? Is this documented anywhere? I guess I can always set the grid properties to save ALL controls, not just dirty ones, but I'd rather not do that.

    Any information and/or pointers would be appreciated.

  • #2
    Re: Does setValue mark field dirty in detail view?

    {grid.Object}.setValue Method

    Syntax

    {grid.Object}.setValue(part,name,row - omit for Search and Detail View,value ,honorChangeEvent)

    Description

    Set the value of a control in the Grid, Search or Detail View part. Part is 'G' , 'D' or 'S' (Grid, Detail View or Search part). Row is only needed for Grid part. For new record rows, row is negative. By default honorChangeEvent is true. This causes the onChange event for the control to fire when the value is set.
    IMPORTANT:The 'name' and 'part' parameters MUST be all UPPERCASE.

    IMPORTANT: Unlike standard Javascript techniques to set the value of a control, the .setValue() method sets the control's state in the Grid Object to be dirty (in the same way that the control becomes dirty if the user types a value into the control). This will set the row to become dirty and the Submit button to become enabled.
    this is from alphapedia. I think it sets dirty.
    even though it says grid object it is applicable to detail view too.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

    Comment


    • #3
      Re: Does setValue mark field dirty in detail view?

      Originally posted by GGandhi View Post
      this is from alphapedia. I think it sets dirty.
      even though it says grid object it is applicable to detail view too.
      Thanks, gg, I read that as well. I don't think it's working, however. I'll have to cobble up a test project to see if it's pilot error or not.

      Comment


      • #4
        Re: Does setValue mark field dirty in detail view?

        I just did a short test and in version 11 the field was dirty and it saved as expected.
        thanks for reading

        gandhi

        version 11 3381 - 4096
        mysql backend
        http://www.alphawebprogramming.blogspot.com
        ggandhi344@gmail.com
        Skype:ggandhi344@gmail.com
        1 914 924 5171

        Comment


        • #5
          Re: Does setValue mark field dirty in detail view?

          Originally posted by GGandhi View Post
          I just did a short test and in version 11 the field was dirty and it saved as expected.
          Thanks for trying to help me out.

          I just did some experimenting.

          My "extension" field has an enable expression. There is a dropdown control (call it "Type") on the detail view with static choices (for example) "A", "B" and "C". The enable expression is Type = "C". The initial value of Type is "A", so the extension field is disabled. When I then enter amounts in Quantity and Rate the OnChange handler is hit and my javascript changes the value in the extension control. However, when I click Save the changes are ignored. I have a small test project using a DBF file attached, but I readily admit that maybe this behavior is to be expected (or there's a problem with my test project).

          Should mention: I tested with 3550-4650.
          Attached Files
          Last edited by nlk10010; 04-28-2016, 09:52 AM.

          Comment


          • #6
            Re: Does setValue mark field dirty in detail view?

            okay instead of calling a calc() you enter the whole thing in onChange event like this
            action javascript, inline javascript then the following ( I copied and pasted the code)
            Code:
            var a = {grid.Object}.getValue('D','QUANTITY');
            var b = {grid.Object}.getValue('D','RATE');
            var c = a * b;
            {grid.Object}.setValue('D','COST',c.toFixed(2));
            and it will update without any problem.
            the problem you see is because javascript is updating, that will not enable the field but direct setting the result like above will.
            thanks for reading

            gandhi

            version 11 3381 - 4096
            mysql backend
            http://www.alphawebprogramming.blogspot.com
            ggandhi344@gmail.com
            Skype:ggandhi344@gmail.com
            1 914 924 5171

            Comment


            • #7
              Re: Does setValue mark field dirty in detail view?

              GG: I'm not sure I understand you, let me see. You're saying that if I enter my js calculation code DIRECTLY into the OnChange event handler then the changes will be saved but if I do it by calling a Javascript function from that handler then it won't? Hey, if it works then fine, I'm not sure how you figured it out (but glad you did) or why there's a difference.

              But note: I obviously don't WANT the "COST" field enabled, I just want it marked dirty. When you say: "that will not enable the field but direct setting the result like above will." do you mean that will set the field DIRTY?

              I hope I'm not confusing you, thanks for the effort you've made. I'm going to try all this out.

              EDIT: Sorry, spoke too soon (unless I misunderstood you). Pasting the code directly into the event handler made no difference. In some ways that's comforting, I suppose. Did you test on 3550-4650?

              Comment


              • #8
                Re: Does setValue mark field dirty in detail view?

                Unlike standard Javascript techniques to set the value of a control, the .setValue() method sets the control's state in the Grid Object to be dirty
                see this line. even though you are using dialog.object setValue method it is still javascript function that updates the field, then you have to manually set it dirty.
                but if you do the way I showed it sets itself dirty without bothering you.
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                ggandhi344@gmail.com
                Skype:ggandhi344@gmail.com
                1 914 924 5171

                Comment


                • #9
                  Re: Does setValue mark field dirty in detail view?

                  no I don't have that
                  but what code did you paste?
                  thanks for reading

                  gandhi

                  version 11 3381 - 4096
                  mysql backend
                  http://www.alphawebprogramming.blogspot.com
                  ggandhi344@gmail.com
                  Skype:ggandhi344@gmail.com
                  1 914 924 5171

                  Comment


                  • #10
                    Re: Does setValue mark field dirty in detail view?

                    sorry I deleted the whole thing I am having difficulty replicating. post soon.
                    thanks for reading

                    gandhi

                    version 11 3381 - 4096
                    mysql backend
                    http://www.alphawebprogramming.blogspot.com
                    ggandhi344@gmail.com
                    Skype:ggandhi344@gmail.com
                    1 914 924 5171

                    Comment


                    • #11
                      Re: Does setValue mark field dirty in detail view?

                      This code:

                      Code:
                      var a = {grid.Object}.getValue('D','QUANTITY');
                      var b = {grid.Object}.getValue('D','RATE');
                      var c = a * b;
                      {grid.Object}.setValue('D','COST',c.toFixed(2));
                      Put it directly in "OnChange", but it made no difference, COST field still would not update.

                      Comment


                      • #12
                        Re: Does setValue mark field dirty in detail view?

                        you seem to be correct, I redid the test including the type and it does not change for some reason.
                        this afternoon I will run some test and see if it helps.
                        sorry.
                        thanks for reading

                        gandhi

                        version 11 3381 - 4096
                        mysql backend
                        http://www.alphawebprogramming.blogspot.com
                        ggandhi344@gmail.com
                        Skype:ggandhi344@gmail.com
                        1 914 924 5171

                        Comment


                        • #13
                          Re: Does setValue mark field dirty in detail view?

                          Originally posted by GGandhi View Post
                          you seem to be correct, I redid the test including the type and it does not change for some reason.
                          this afternoon I will run some test and see if it helps.
                          sorry.
                          Please, don't be sorry, I appreciate your efforts (unless of course you consulted on AA4 and told Alpha to make sure disabled fields aren't marked dirty :) ).

                          Comment


                          • #14
                            Re: Does setValue mark field dirty in detail view?

                            http://screencast.com/t/rFDT776iPbB

                            okay I redid the test, this time I changed the editing to all fields and updating to all fields and it works as expected take a look.
                            thanks for reading

                            gandhi

                            version 11 3381 - 4096
                            mysql backend
                            http://www.alphawebprogramming.blogspot.com
                            ggandhi344@gmail.com
                            Skype:ggandhi344@gmail.com
                            1 914 924 5171

                            Comment


                            • #15
                              Re: Does setValue mark field dirty in detail view?

                              Yes, since Alpha is NOT setting the disabled fields to dirty the only solution I found was to set the update method to "ALL" fields rather than just the dirty ones. I believe I alluded to that in my OP; my object in posting was to ask why that's the case, I should (at least IMO) be able to set the update method to "Dirty Fields Only". IOW, I don't see why Alpha would not mark a field whose contents have been changed to dirty just because it's not enabled.

                              Thanks for working through this with me, I guess this is normal behavior in Alpha and we'll just have to live with it.

                              Comment

                              Working...
                              X