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

Pointer to where I would find out how to refresh a dropdown on dialog

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

    Pointer to where I would find out how to refresh a dropdown on dialog

    I have a dialog, with 4 tabs. User gets to tab 2, enters a username / password (NOT linked to A5 security, just for basic ID purposes). Once they enter that info, I need to populate a DROPDOWN box that corresponds to a list of items that belong to that username.

    Have the login function working, etc... but I cannot figure out how to either:

    A) Populate the dropdown via SQL Statement with WHERE clause

    B) Refresh the dropdown (as the filter is already set up for this via IDE).



    I have been searching since yesterday afternoon to figure this out but cannot. I found something for grids, but not dialogs.. and I'm really stuck.

    Even if someone told me where to search/how to search for something so vague, that would be great.

    thanks!

    #2
    Re: Pointer to where I would find out how to refresh a dropdown on dialog

    I think Video D41 will be a good place to start.

    http://www.ajaxvideotutorials.com/V1...opdownBox1.swf
    http://www.ajaxvideotutorials.com/V1...opdownBox2.swf

    You say you have a filter on the dropdown - set up via IDE - but I don't see a filter option for this control in a dialog... where's that set?

    I'll post the code required in the Ajax Callback to perform a SQL Query... have a look at the videos in the meantime.

    Comment


      #3
      Re: Pointer to where I would find out how to refresh a dropdown on dialog

      Thanks David. I did review them but I'm still unsure of.when to use xbasic vs. JavaScript etc.

      I set the filter when you define the dynamic choices for the dropdown. I selected the expert tab and created a where statement with a variable for a client id.

      But I also would like the dropdown hidden or locked until the login part is done so they cannot mess with it.

      While I'm at it how does one hide/show a control via code? Im lost with so many examples and places to look a search usually returns so many non-relavant results. THANK YOU!!!!

      Comment


        #4
        Re: Pointer to where I would find out how to refresh a dropdown on dialog

        DBF or SQL Tables?

        Generally, use XBasic when you need to get at data on the server. Use Javascript when you want to manipulate data, fields, controls, etc. at the client level.

        XBasic as well when you want to do some stuff with data, calcs etc. I find you can use either for this, it's just a little tougher in Javascript sometimes.

        Comment


          #5
          Re: Pointer to where I would find out how to refresh a dropdown on dialog

          SQL (MySQL) thank you!!

          Comment


            #6
            Re: Pointer to where I would find out how to refresh a dropdown on dialog

            So to hide or show a frame or field etc its all JavaScript. Thanks!!

            Comment


              #7
              Re: Pointer to where I would find out how to refresh a dropdown on dialog

              Yes... have a look at the your control's Client Side Properties - Show/Hide Expression

              Comment


                #8
                Re: Pointer to where I would find out how to refresh a dropdown on dialog

                An Ajax Callback running off one of your control's onChange event will work nicely for populating your dropdownbox. This code is borrowed from a few places... from Steve Workings... thanks Steve...

                http://msgboard.alphasoftware.com/al...-box-in-dialog

                and from the video mentioned above. The following function is used as an Ajax Callback...

                Code:
                function popDropdown as c (e as p)
                	
                dim eleId as c = "{dialog.componentname}.V.R1.CBOPRODUCTS"       'get the dialog's dropdown element
                dim UserName as c = e.DataSubmitted.Username	                    'get the data we want to use as an arg in the SQL Select statement
                dim cn as sql::Connection                                                          'set up the SQL Connection
                cn.open("::Name::YOURNAMEDCONNECTION","YOURLOGINID","YOURPASSWORD")
                dim args as sql::Arguments
                args.set("UserName", UserName)                                                 'set up the SQL Argument
                table = "tblProducts"
                filter = "ProdColour <> :UserName"
                results = "ProdName"
                
                ' sql_get_values(Connection as A, table as c, filter as c, result_expression as c [, flagDistinct as L [, Limit as n [, flagDescendingOrder as L [, arguments as sql::arguments ]]]])
                vList =  sql_get_values(cn, table, filter, results,.f.,1000 ,.f., args)
                vList = sortsubstr(vList, crlf())
                vList = js_list_to_array(vList)
                
                js = "A5.form.populateSelect('" + eleId + "',''," + vList + ",true);"
                popDropdown = js
                
                end function

                Comment


                  #9
                  Re: Pointer to where I would find out how to refresh a dropdown on dialog

                  David, AWESOME. Thank you!!!!!!!!!!!!!!!!!!!!!!

                  In reference to the hide/show expression, how would that be set in code? I.E. if login was successful, show FRAME (or the above mentioned dropdown)?

                  I guess my issue really is, how do I know how to reference properties of the particular control via code? In VB, its "controlname.visible = false", but not sure along these lines. Sorry for such newbie questions, but the whole Javascript is new and I can't really find a good map to properties/examples for simple stuff like that in code, only in the IDE.

                  Thanks!

                  Comment


                    #10
                    Re: Pointer to where I would find out how to refresh a dropdown on dialog

                    PS.. I really love the support of everyone on this board, who really take the time to answer questions, even ones that have been asked before, and do not make us newer folks feel like idiots or burdens. It is really nice and thank you.

                    Comment


                      #11
                      Re: Pointer to where I would find out how to refresh a dropdown on dialog

                      I'm not sure how you are validating your non-security Username/Password - the following kinda depends a bit on how that's done. Further, there are a few ways to get the job of hiding and showing done. Let's do it in a fairly simple way all in Javascript... just 'cause it's fun.

                      If you're validating your User in Javascript then in that validation you could either Hide or Disable the dropdown. Hiding the dropdown can affect your page in two different ways: 1. The dropdown will still take up space on the page - even though you can't see it. 2. The dropdown will be hidden and will not take up space on your page and the rest of your page will shift accordingly.

                      style.display = 'block'; show the object.
                      style.display = 'none'; hide the object and don't take up any space
                      style.visibility = 'visible';
                      style.visibility = 'hidden'; the object still takes up space on the page - you just can't see it
                      disabled = true;
                      disabled = false;

                      So, your Javascript code, which would run after you validate your user, could be something like...

                      Code:
                      // the following line is getting the value of my dialog control, named UserName
                      var currUser = {dialog.Object}.getValue('USERNAME');
                      if (currUser == 'David')
                      	{
                      //	$('{dialog.componentname}.V.R1.CBOPRODUCTS').style.display = 'block';
                      //	$('{dialog.componentname}.V.R1.CBOPRODUCTS').style.visibility = 'visible';
                      	$('{dialog.componentname}.V.R1.CBOPRODUCTS').disabled = false;
                      
                      	}
                      else
                      	{
                      //	$('{dialog.componentname}.V.R1.CBOPRODUCTS').style.display = 'none';
                      //	$('{dialog.componentname}.V.R1.CBOPRODUCTS').style.visibility = 'hidden';
                      	$('{dialog.componentname}.V.R1.CBOPRODUCTS').disabled = true;
                      	}
                      Again... not sure how you're validating, but you could set a variable and then test on that variable... just like the code above is testing for a specific value. Also, if you have a label... you'll have to hide that as well.

                      Do you know about Firebug... which runs under Firefox?
                      Last edited by Davidk; 05-03-2012, 01:19 PM.

                      Comment


                        #12
                        Re: Pointer to where I would find out how to refresh a dropdown on dialog

                        Thanks David, yes I use firefox sometimes.. I haven't really played with Firebug and A5, but I think I'll check it out again. Thank you! The above all really helps!!

                        chris

                        Comment


                          #13
                          Re: Pointer to where I would find out how to refresh a dropdown on dialog

                          David, is there a way of using the sql_get_values to include VALUE for each dropdown, not just the text part?

                          I've been playing around, and only way I can see in the forums is using a lot more code to get the values... didn't know if there was a shortcut with that function.

                          Thank you!

                          Comment


                            #14
                            Re: Pointer to where I would find out how to refresh a dropdown on dialog

                            The "results" variable holds the value or values being selected from the sql table. If you include more than one sql fieldname then all will be returned. E.g. results = "ProdName, ProdPrice" will return both fields, delimited by the pipe "|" character. Now... the question is... what has to be done to the "results" variable in order for the balance of the code to deal with the DisplayValue and StoredValue?

                            Comment


                              #15
                              Re: Pointer to where I would find out how to refresh a dropdown on dialog

                              Yes, that is what I'm after... the how do we split displayvalue and storedvalue for the sql_get_values to delineate properly in the drop down?

                              Thanks! :)

                              Comment

                              Working...
                              X