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

How to pass a variable from a grid to a dialog

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

    How to pass a variable from a grid to a dialog

    I created a dialog for the purpose of allowing my user's to send an e-mail to customer's from within the A5 app that would also commit the communication to the SQL database. I have an action javascript button that opens the dialog and what I would like to do is pass along some of the information from the selected record where the action button exists to the dialog. I have gone into Argument Bindings and have set the session variable with the following code.

    donorid = {javascript}function(rowNum) { return {grid.object}.getValue('G','ID',rowNum); }(rowNum)

    In the default value for the dialog I have set the default value to =session.donorid and have tried =donorid

    When opening the dialog I receive the error "Record Not Found". I also was wondering. Is it possible to use the send e-mail action javascript inside of a dialog?

    Any feedback is much appreciated.

    #2
    Re: How to pass a variable from a grid to a dialog

    In the grid add a button:
    Click the OnClick Javascript event.
    Add New Action>In Line Javascript

    Add this code:
    window['__callingGridAlias']={grid.Object}.gridId;
    window['__callingGridRow']='{Grid.RowNumber}';
    {grid.Object}.rowCollapse({Grid.RowNumber}); //i add this because then it collapses the row, and when the user expands the row, it forces a refresh

    Add New Action
    Open Dialog Component


    In your DIalog, Client Side Events

    OnInitializeComplete:
    var grid_id=window['__callingGridAlias'];
    var row_num=window['__callingGridRow'];
    if (typeof grid_id !='undefined' && typeof row_num !='undefined'){
    var sub_id=window[grid_id+'_GridObj'].getValue('G','SUBSCRIBER_ID',row_num);
    {dialog.Object}.setValue('cmbSubscriberID',sub_id);
    {dialog.Object}.setValue('txtSubscriberID',sub_id);
    }

    I also put this code in the 'AfterResetForm' event.

    Good luck
    Scott Moniz - Computer Programmer/Analyst
    REA Inc.
    http://reainc.net
    (416)-533-3777
    [email protected]

    REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
    If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
    contact us to discuss options.

    Comment


      #3
      Re: How to pass a variable from a grid to a dialog

      This doesn't appear to work for me.

      I found a video that Selwyn created and followed his tutorial. I am trying to use the following javascript as provided in the example as inline javascript before the action to open the dialog. It throws me an error.

      window['v_var1'] = {grid.object}.getValue('G','ID',{Grid.RowNumber});
      window['v_var2'] = {grid.object}.getValue('G','EmailAddress',{Grid.RowNumber});

      Is the syntax wrong here?

      Comment


        #4
        Re: How to pass a variable from a grid to a dialog

        Hi

        I was not very successful with the "window[" syntax shown in the video.

        I have used the $sa and $ga methods with success. Just make sure that you investigate the fully qualified names of the fields with Firebug.

        wiki.alphasoftware.com/Getting+and+Setting+Values+and+Attributes+Core.JS&structure=What

        Comment


          #5
          Re: How to pass a variable from a grid to a dialog

          Eriks,

          Thank you for your response. I am not too familiar with JS but am working to try and become more proficient. I am not sure how to get the value into a dialog control using that method. I attempted it but don't think I have the proper syntax for referencing the parent grid/fields.

          I am working with the method Scott provided. I am sure there is something I am doing wrong.

          I've created a action button on the parent grid with two actions. The first action is inline javascript. The script is
          window['__callingGridAlias']={grid.Object}.gridId;
          window['__callingGridRow']='{Grid.RowNumber}';
          Which Scott provided. The second action is to open the dialog.

          On the dialog in the OnInitializeComplete I have this script entered:
          var grid_id=window['__callingGridAlias'];
          var row_num=window['__callingGridRow'];
          if (typeof grid_id !='undefined' && typeof row_num !='undefined'){
          var donor_id=window[grid_id+'_GridObj'].getValue('G','ID',row_num);
          var donor_EmailAddress=window[grid_id+'_GridObj'].getValue('G','EMAILADDRESS',row_num);
          {dialog.Object}.setValue('Donor',donor_id);
          }

          I also created a video so that you could see for yourself what I am doing and probably doing wrong.

          http://www.envisionsolutions.net/vid...esToDialog.swf

          Thank you!

          Comment


            #6
            Re: How to pass a variable from a grid to a dialog

            Hi cole, the code I gave you works. I have it working in a current application. I tried to help you quickly, but it looks like their may be something specific on your grid that is causing the code not to work. If you would like help with this issue, you can contact me at [email protected]. We provide support to other alpha developers and I'm sure we would be able to assist yo with this issue and any other you may find.


            Feel free to contact me if you can't get this figured out.
            Scott Moniz - Computer Programmer/Analyst
            REA Inc.
            http://reainc.net
            (416)-533-3777
            [email protected]

            REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
            If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
            contact us to discuss options.

            Comment


              #7
              Re: How to pass a variable from a grid to a dialog

              Josh
              The syntax you posted appear to be correct.
              2 ways to go about it:

              1) Use an unbound Dialog and use a session var as per you original post. I copy pasted you expression and it worked.

              2) Use a bound dialog, bind it to the table the grid is based on (Customers I suppose), no need for session var. When you select the table to do the binding in the dialog, make sure the pk you specify in here is the same you specify in the Open Dialog js on the grid . In the Open Dialog actionJS button in grid select Populate dialog with data from table, and select the same pk as in dialog.
              HTH
              Try and let's know

              Comment


                #8
                Re: How to pass a variable from a grid to a dialog

                Gaby,

                You are awesome. I guess the problem was the fact that I had bound the dialog to a table. Once I removed that my original method worked fine. Binding it really was going to make it easier though to write the data to the database as well as shoot the e-mail off. I guess that is a limitation or I am missing something.

                Comment


                  #9
                  Re: How to pass a variable from a grid to a dialog

                  A bound dialog should work. If you are getting 'Record Not Found' error, it's most likely due to a pk issue; the pk selected in the dialog when doing the biding (select table window) must be the same pk field selected in the Open dialog js.
                  A basic scenario is: in the dialog in Select table under table proper -> primary key field: custid
                  In the open dialog button on grid, in Populate data from table category -> Control on current component: custid

                  Comment


                    #10
                    Re: How to pass a variable from a grid to a dialog

                    If you use my method, im not quite sure, but make sure the fields you are using .GetValue on are Textboxes (or some other type of readable control e.g checkbox, select box).
                    Ive seen alpha have trouble when yout ry to GetValue from labels or custom fields.

                    If you need to you can make a dummy field.
                    Example:
                    SELECT *, donor.id as dummy_donor_id FROM donor

                    Then you can put dummy donor id as a textbox control on the grid with the Hide Row option checked.
                    Scott Moniz - Computer Programmer/Analyst
                    REA Inc.
                    http://reainc.net
                    (416)-533-3777
                    [email protected]

                    REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
                    If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
                    contact us to discuss options.

                    Comment

                    Working...
                    X