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

DetailView...canDetailViewSubmit event help

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

    DetailView...canDetailViewSubmit event help

    In my app, I have a non-edit grid that calls a DetailView to enter location information and coordinates. The user selects the type of coordinate they will enter from a drop down field (Degree Minute Second, Degree Minute Decimal Minute, or Decimal Degree) and enters the coordinates. I am attempting to convert and update the other "non-selected coordinate" fields as the record is saved. I set a flag field whenever a coordinate entry is changed to note that coordinates have to be updated/recalculated.

    I call this conversion function in the Client Side, canDetailViewSubmit event. The event checks if the flag is set and if so, makes an ajax callback to run the conversions.

    I have an alert set in the event to show if the flag is set and within the function "debug(1)" set so I can check on the converted data. The e. data is being properly calculated.

    When I run this with starting with the grid "New Record" navigation button, when I hit the "save" button, the "new" record shows in the grid, but the "other" coordinates are not saved to the record (MySQL records) and when I click on that grid record (or for that matter, any other grid record), I get a "You must first save or cancel your changes" error dialog.

    The calculated data is missing and the record is not complete.

    Any ideas where to look to correct this?

    #2
    Re: DetailView...canDetailViewSubmit event help

    Probably has to do with the asynchronous nature of a callback: the new record does not yet exist in the table when you make the callback. You could try with a settimeout.
    Frank

    Tell me and I'll forget; show me and I may remember; involve me and I'll understand

    Comment


      #3
      Re: DetailView...canDetailViewSubmit event help

      Frank,

      Not familiar with the use of settimeout. If my callback function is named setlatlng, is this how I would code it:

      setTimeout(function(){{grid.Object}.runAction('setLatLng');},1000);

      Jack

      Comment


        #4
        Re: DetailView...canDetailViewSubmit event help

        Jack,

        Looks good to me. A 1 sec delay should be ok. You could also think of doing the ajax callback in the afterdetailviewsubmit event I'd say.
        Frank

        Tell me and I'll forget; show me and I may remember; involve me and I'll understand

        Comment


          #5
          Re: DetailView...canDetailViewSubmit event help

          Frank,

          Tried it in both events...in the afterDetailViewSubmit event, the warning about saving/canceling changes went away, but neighter event actually updated the inputs.

          I went with the "can" event because it appeared from its description that it would run prior to saving the record. I thought the error might be caused because the record was saved before the setLatLng function was run...guess not.

          Since this is run on my local machine without running through the "network," I thought the 1 sec delay would be way more than enough...if it was caused by the time out problems.

          Any other ideas?

          Jack

          Comment


            #6
            Re: DetailView...canDetailViewSubmit event help

            Frank,

            I've delayed 2 seconds (2000) and although its a very easy to "see" the delay, it makes no difference on saving the record updates. I'm guessing that something else is wrong, but I'm out of ideas on what.

            Jack

            Comment


              #7
              Re: DetailView...canDetailViewSubmit event help

              Have you thought about using a trigger?
              There are no timing issues.

              Michael

              Comment


                #8
                Re: DetailView...canDetailViewSubmit event help

                Michael,

                Explain? I'm in the process of adding a button and moving the conversion routines there to avoid the "after save" problem.

                Jack

                Comment


                  #9
                  Re: DetailView...canDetailViewSubmit event help

                  From just glancing through your post, I'm wondering if "CanUpdateRecord" and "CanInsertRecord" under Server Side Events would be a better place to recalculate fields, assuming you're not going with a DB Trigger. Those events give you access to the old data using "dataSubmitted.oldValues." pointer variable. So, no need to maintain your own flag to indicate what has been changed. Just compare like "IF dataSubmitted.myField <> dataSubmitted.oldValues.myField". There is also the "args.IsNewRecord" flag in those events. You can make adjustments to the "dataSubmitted.(your_fields)" values and they will get written back to the DB and the browser.

                  Comment


                    #10
                    Re: DetailView...canDetailViewSubmit event help

                    Rich,

                    Thanks for the input. Currently I've got the problem "solved" by a button placed in the DetailView after the coordinate entry...but I prefer the automatic update.

                    The "canUpdateRecord" might be used to update existing records, and initially the "canInsertRecord" might work for the new record inputs.

                    On closer reading of the Client Side "canDetailViewSubmit" indicates that it "Fires when the user tries to submit edits made to a record in the Detail View." I interpreted this to mean that it would fire when I "saved" the record, but it might translate to meaning edits to an existing record in Detail View. At any rate, even though my function is properly triggering and calculating proper e. data, the "canDetailViewSubmit" and "afterDetailViewSubmit" events are not actually saving the e. data that I'm reading in the debug window.

                    I'll try your recommendations tonight/tomorrow and let you know the outcome.

                    Jack

                    Comment


                      #11
                      Re: DetailView...canDetailViewSubmit event help

                      If you make changes to data fields using javascript (client-side), make sure you use the "{grid.object}.setValue('D', FIELD_NAME, Field_Value)" so the field and detail view get marked "dirty". Make sure you have the field name in upper-case. If you have an error in javascript you probably won't see it unless you turn on a debugger. And if the javascript library has code to ignore a particular error you might not see anything at all until you trace the Javascript code.

                      Comment


                        #12
                        Re: DetailView...canDetailViewSubmit event help

                        I have a similar application & I use the serverside events Afterupdaterecord & Afterinsertrecord. It is difficult to say from here without going through all your code/components etc to see what is going on. Firebug's console view could be a first step to see what is going on client side, the Alpha debugger serverside. This is the fun part of programming & this is what you learn from most but admittedly it can be somewhat frustrating :-)
                        Frank

                        Tell me and I'll forget; show me and I may remember; involve me and I'll understand

                        Comment


                          #13
                          Re: DetailView...canDetailViewSubmit event help

                          Still struggling with this...perhaps I'm looking at the problem wrong.

                          Is there a way to intercept the "Save" button on the Detail View toolbar so I can add code to execute before the actual save? I've been looking at the events, but is there an easier way such as when you create your own action button to list the steps/sequence the onClick event takes?

                          Jack

                          Comment


                            #14
                            Re: DetailView...canDetailViewSubmit event help

                            hello

                            sorry to ask you a question after 13 posts, i went back to your first post. i am not able to understand your situation.
                            you have a grid and to enter a new record you call a detail view, that is normal.
                            you enter the data in few fields and update other fields using canDetailViewSubmit function, why? why not onChange event of the field?
                            i have calculated fields in my detail view and they are calculated correct thru onChange event and submitted properly and shows up on the grid after saving.
                            is this because you do not know which fields are changing? or some other circumstance that i do not know at all.
                            if you are able to post a screencast or an image of the screen and tell what exactly you want to do, i am sure you will be able to get proper answer from many and solve immediately.
                            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


                              #15
                              Re: DetailView...canDetailViewSubmit event help

                              Gandhi,

                              My Detail View coordinate entry is broken into individual fields...based on the type of coordinate the user enters. For example, if entering a coordinate in a Degree Minute Second format, I have a degree field, a minute field, and a second field. Initially I attempted to use a calculation fired from the onChange event as each field was entered, but that caused "infinite" loops...each time a field was changed, the calculation "changed" the field(s) and that change caused it to recalculate etc. In the end I had to shut down a5 to break the loop.

                              I then set a flag field to to note that data was changed and calculate only when the user saves the record.

                              The "other coordinate fields" are not displayed to the user. If they enter as Deg. Min. Sec., only the Deg. Min. Sec. fields are displayed, but my application uses these other fields internally for map functions.

                              Jack

                              I should have added that all coordinate fields are "available" in the Detail View form, but not enabled unless that type coordinate is selected. If the uses selects a Degree Decimal Minute type, the DMM fields are enabled/displayed and the other types are "not enabled" and not displayed. They're not internal only fields.

                              Comment

                              Working...
                              X