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

a5_AJAX_window()

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

    a5_AJAX_window()

    Can you make a floating window by using the a5_AJAX_Callback(), with something like this on the callback page? My calling page has a <div> with ID="StatusContainer". This is a starting point, but nothing's happening.

    Code:
    <%A5
    ' Callback Page script:
    DetailViewFloatingWindow()
    
    function DetailViewFloatingWindow as c (vars as p)
    with vars 
    
    DetailViewFloatingWindow = <<%txt%
    	StatusContainer_FLOATING_WINDOW = new a5_AJAX_window({
    			title: {
    				html: 'Detail View'
    			},
    			body: {
    				contentId: 'StatusContainer',
    				className: 'WindowBody  __styleName__PageBODY'
    			},
    			footer: {
    				buttons: []
    			},
    			modal: false,
    			autoShow: false,
    			onClose: function(buttonPressed) {
    				//this does nothing, because this window does not specify any buttons in the footer section.
    				return true;
    			}
    		});
    %txt%
    
    ?DetailViewFloatingWindow
    
    end with 
    end function 
    
    %>
    -Steve
    sigpic

    #2
    Re: a5_AJAX_window()

    Try changing "autoShow: false," to "autoShow: true,".

    Also, be aware that the variable "StatusContainer_FLOATING_WINDOW" will only exist in the scope of the ajax response handler - therefore you will not be able to access it in the page after the ajax response has been handled.

    An alternate way of getting a window to be shown on a response is to create the window when the page is initially loaded (leaving "autoShow" to be "false"), and then to insert the code to show the window on the callback response. In this case:

    Code:
    StatusContainer_FLOATING_WINDOW.show();
    The window has two ways in which it can get its content: from an HTML string paced in, or from an HTML element already on the page (as you are currently doing).

    If "StatusContainer" is being filled with differnt HTML on the response, you could possibly switch to feeding the "StatusContainer_FLOATING_WINDOW" object that HTML. For example:

    Code:
    StatusContainer_FLOATING_WINDOW.body.html = 'Hello world';
    StatusContainer_FLOATING_WINDOW.show();
    Also, if you merely wish to display a message to the user, you might consider using the "a5_msg_box.show()" function, that wraps a window control, and provides a quicker way of genreating generic message boxes (you can still place any HTML in the message box, so INPUTs, TEXTAREAs, and SELECTs should work).

    Hope that helps,

    Eavan

    Comment


      #3
      Re: a5_AJAX_window()

      Thanks Eavan -

      Been teaching all day so will get back to this later.

      What I'm looking to do is take a couple pieces that are taking up too much grid space and put them into a popup window. Sort of like the Detail component in the Web Apps samples, but not exactly.

      The popup window will have fields with checkboxes and a Submit button as would any other dialog to record the user input to the appropriate record.

      I think I'm on the right track but will have to fiddle some more...
      -Steve
      sigpic

      Comment


        #4
        Re: a5_AJAX_window()

        Well, finally back to this one. It seems clear to me that the button I've devised isn't even calling the AJAX page. What's wrong with this:?

        Code:
        <button id="windowFromContent" onclick="a5_AJAX_Callback('A4_ContentWindow.Ajax.A5W','');" > Test Button</button>
        -Steve
        sigpic

        Comment


          #5
          Re: a5_AJAX_window()

          I don't see anything wrong - might be something in you AJAX A5W page.

          If you are not already, you'll want to use a combination of FireFox, and FireBug (debug for firefox). FireBug will show you pretty much everything that goes on in the browser - specifically what is getting sent to the server, and what is being returned. It is probably the best thing since sliced bread.

          Eavan

          Comment


            #6
            Re: a5_AJAX_window()

            Well, Eavan, you can see the button I'm using to call the page.

            And I've shown you the A5 script and made the change you suggested to get the window.

            Nothing. Nada.

            And I'm using FF3 and Firebug. Guess I'll resume digging with my teaspoon...
            -Steve
            sigpic

            Comment


              #7
              Re: a5_AJAX_window()

              Let me start this one afresh maybe. I need to display, effectively, a dialog component or grid in an AJAX Window.

              How? The sample code that comes with A5 is just simply daunting and my customer needs something now. I have neither the time or money to invest in trying to modify the sample code to fit my needs. But the AJAX window appears to be a relatively simple construct that is worth pursuing. Or maybe I oughta be taking another approach?
              -Steve
              sigpic

              Comment


                #8
                Re: a5_AJAX_window()

                This is a simple example:

                HTML File:

                Code:
                <html>
                <head>
                <title></title>
                <script type="text/javascript" src="javascript/core.js"></script>
                <script type="text/javascript" src="javascript/aui.js"></script>
                <script type="text/javascript" src="javascript/AjaxFormLibrary.js"></script>
                <script type="text/javascript" src="CSS/A5System/default/theme.js"></script>
                <link rel="stylesheet" type="text/css" href="CSS/A5System/Vista/theme.css" />
                </head>
                <body>
                	<button onclick="a5_AJAX_Callback('__ajax_windowExp.ajax.a5w','__action=loadForm');">Load Form</button>
                	<div id="form1" style="display: none;">
                		Firstname:<br />
                		<input id="firstname" /><br />
                		Lastname:<br />
                		<input id="lastname" /><br />
                	</div>
                </body>
                </html>
                
                <script type="text/javascript">
                <!--
                
                var formWindow = new a5_AJAX_window({
                		title: {
                			html: 'Detail View'
                		},
                		body: {
                			contentId: 'form1'
                		},
                		footer: {
                			buttons: [
                				{html: 'Save', value: 'save'},
                				{html: 'Cancel', value: 'Cancel'},
                			]
                		},
                		modal: true,
                		autoShow: false,
                		onClose: function(buttonPressed) {
                			if(buttonPressed == 'save'){
                				// get values from form, and return them to the server.
                				// we're using 'a5_AJAX_Form_SubmitValueParam' to create strings like: 'firstname=Eavan' - it does urlencoding.
                				// '$gvs' is used to get values
                				// we're using an array so we can join the values later...
                				var data = new Array();
                				data.push(a5_AJAX_Form_SubmitValueParam('firstname',$gvs('firstname')));
                				data.push(a5_AJAX_Form_SubmitValueParam('lastname',$gvs('lastname')));
                				
                				// add a parameter telling us the action we are taking - saving the form
                				data.push('__action=saveForm');
                				
                				// convert data to a valid url parameter string.
                				data = data.join('&');
                				
                				// do the callback
                				a5_AJAX_Callback('__ajax_windowExp.ajax.a5w',data);
                			}
                			
                			return true;
                		}
                	});
                	
                $('form1').style.display = '';
                
                //-->
                </script>
                A5W page named "__ajax_windowExp.ajax.a5w":

                Code:
                <%a5
                
                dim __action as c = default ""
                
                if __action = "loadForm" then
                	' code that actually fills in the form with useful values here - currently I hard coded it.
                	' '$svs' is used to set the value of a form control - if you are setting multiple values (i.e. select list, checkbox group), then use JSON array syntax (['value1','value2','valueN']).
                	?"$svs('firstname','Eavan');"
                	?"$svs('lastname','Chambliss');"
                	?"formWindow.show();"
                else if __action = "saveForm" then
                	dim firstname as c = default ""
                	dim lastname as c = default ""
                	
                	' code to save value here
                	
                	
                	' obviously not required - but just to prove it got here.
                	?"alert('You\'ve save the form...\nName: "+firstname+" "+lastname+"');"
                end if
                
                %>

                Basically, we create the form initially, place it in the window by using "contentId", and then fill in and save the values in the form via callbacks.

                For a grid, it would probably be easier to not use the "contentId", but rather construct the HTML for the grid on the server. Opening the window would then be like this:

                Code:
                formWindow.body.html = '{Grid HTML Here}';
                formWindow.show();
                You could still use "contentId", and just fill in the "innerHTML" of the DIV you are using for the "contentId" - this would allow you to navigate the grid via AJAX, and not close the window:

                Code:
                $('form1').innerHTML = '{Grid HTML Here}';
                formWindow.show();
                And on a navigate just do:

                Code:
                $('form1').innerHTML = '{Grid HTML Here}';
                Hope that helps,

                Eavan

                Comment


                  #9
                  Re: a5_AJAX_window()

                  Thanks Eavan - that does help. Finally gives me a workable, understandable base. I need to show a form with several logical/checkboxed fields, filled with values appropriate to a particular record ID - I think I know how to run with what you've supplied.

                  I appreciate your extra effort, and as others work to learn this, what you've just offered will have lasting value.
                  -Steve
                  sigpic

                  Comment


                    #10
                    Re: a5_AJAX_window()

                    And the way to put a thin border around this entire floating window, or a different background color around the entire window would be....?

                    Thanks.
                    Jay
                    Jay Talbott
                    Lexington, KY

                    Comment


                      #11
                      Re: a5_AJAX_window()

                      The a5_AJAX_window() takes a javascript object containing settings that define the window. These properties can include style information. Below is a mock-up of a window with just the style properties in the settings object:

                      Code:
                      a5_AJAX_window({
                      	className: '', // ClassName for the DIV that contains the entire window
                      	lockUIClassName: '', // ClassName for the DIV that will be used to lock the UI if the window is modal
                      	title: {
                      		className: '', // ClassName for the title element
                      		imageClose: '', // Close button image URL
                      	},
                      	body: {
                      		className: '' // ClassName for the DIV that contains the "body" of the window
                      	},
                      	footer: {
                      		className: '' // ClassName for the DIV that contains the footer (i.e. buttons)
                      	}
                      });
                      Just create a stylesheet with classes for each part of the window you would like to style, and then place those class names in the corresponding property in the window settings object.

                      Eavan

                      Comment


                        #12
                        Re: a5_AJAX_window()

                        Thanks, Eavan. I appreciate it (not to mention all the cool stuff you and the others at Alpha are doing).
                        Jay
                        Jay Talbott
                        Lexington, KY

                        Comment


                          #13
                          Re: a5_AJAX_window()

                          Just thinking about how easy it will be to achive this in v10, cant wait!!
                          Cheers
                          Mauricio

                          Comment

                          Working...
                          X