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

Dropdown list filter

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

  • Dropdown list filter

    Is anyone else having the problems I'm having with dropdown filters?

    I have several grid variables where the dropdown list for the variable is to be filtered on the value of a previously-filled variable.

    For instance:

    with tmpl.field_info[8]
    .Fieldname = "Event_Timezone"
    .Scope = "Local"
    .DisplayFormat = ""
    .DisplayUnFormat = ""
    .Type = "C"
    .Updateable = .t.
    .Table_Alias = "events"
    .FieldToUpdate = "Event_timezone"
    .Varname = "EVENT_TIMEZONE"
    .NullIfBlank = .f.
    .Controltype = "DropDownBox"
    .DropdownBox.InLineStyle = ""
    .DropdownBox.Type = "Dynamic"
    .DropdownBox.StyleFieldIfError = .t.
    .DropdownBox.ErrorInLineStyle = ""
    .DropdownBox.Size = 1
    .DropdownBox.selectStyle = "Single"
    .DropdownBox.NotInListRule = "Do Nothing"
    .DropDownBox.Datasource = "DBF-Table"
    .DropDownBox.Table = "[PathAlias.ADB_Path]\TimeZones.dbf"
    .DropDownBox.DisplayValueField = "Zonecode"
    .DropDownBox.StoredValueField = "Zonecode"
    .DropDownBox.maxchoices = 0
    .DropDownBox.Filter = "ut(location) = UT([varC-"EVENT_TIMEAREA])"
    .Column.Hide = .t.
    end with

    The dropdown list, however, is empty.

    I've tried variants of this for 2 hours, so thought I'd put it out here for help.

    TIA

    - Steve
    -Steve
    sigpic

  • #2
    RE: Dropdown list filter

    i would really need to see your app, but this line is wrong:

    .DropDownBox.Filter = "ut(location) = UT([varC-"EVENT_TIMEAREA])"


    what is varC-"event_timearea?


    assuming you had some variable called (say) vEventTimeArea, the correct syntax would be

    .DropDownBox.Filter = "ut(location) = " + quote(vEventTimeArea)

    Comment


    • #3
      RE: Dropdown list filter

      I'm just using the filter builder in the grid component. It works just fine in the dialog component, but the grid component seems to be a problems.

      For instance:

      In a dialog component, I can specify a filter of

      Location = ?

      and fill in the genie to specify what the "?" is about. Works just fine.

      The filter looks like this:

      .DropDownBox.Filter = "Location = [varC-"vTimeZoneArea]"

      Do the same thing in the grid component, with Event_TimeArea as a previously-filled variable on the grid, and get the filter I showed you and an empty dropdown list.

      The filter looks like this:

      .DropDownBox.Filter = "Location = [varC-"EVENT_TIMEAREA]"

      Should I be specifying something other than a variable in the grid filter? The only other option is a constant.

      Thanks.
      -Steve
      sigpic

      Comment


      • #4
        RE: Dropdown list filter

        steve

        I think you have run into a bug.

        Only the dialog component supports 'cascading' dropdowdown boxes. A cascading dropdownbox is one where a selection in one drop down box causes the form to submit and the selection in another dropdown box to automatically adjust based on the selection in the first dropdown box. (e.g. example 2.1 in the demo app).

        When you define a dropdown box in a dialog and you filter it based on the value in another dropdownbox on the dialog, a5 automatically writes the correct html to cause the form to submit itself (using javascript) when the selection in the first dropdown box occurs.


        Grid components do not allow for for this. The 'bug' is that the choice builder for the dropdown box gave you the option of using a ? in the filter expression. It should not have. This option should have been restricted to Dialog components. The 'bug' occured because this choice builder is common to both the grid and dialog builder.

        Comment


        • #5
          RE: Dropdown list filter

          So there's no workaround or other solution? I have a few grids built with the expectation I'd be able to solve the problem. I'd hate to have to redo 'em all as dialog components.

          - Steve
          -Steve
          sigpic

          Comment


          • #6
            RE: Dropdown list filter

            are these drop down boxes in the "search" part of your grid?

            i suspect that a clever programmer could work around the problem by changing to a free form layout and then manually adding the javascript necessary to autosubmit the search part of the form.

            if you looked at the html that the dialog component generated for an dropdown box that causes the dialog form to auto-submit, you would see how to do it.

            Comment


            • #7
              RE: Dropdown list filter

              i have tried desperately to set the onchange property
              in a grid dropdown and still haven't been able to do it
              i have 2 forms that i would like to execute some javascript
              when the user changes the value of the dropdown . the freeform part allows me to be able to do everything EXCEPT set the value of the onchage property of the dropdown.
              i have also attempted to to do the same with the onload event
              by attempting to set the on change event for the dropdown when the form loads ,
              but still no luck the html generated always is the same

              ONCHANGE = ""

              the only way i have been able to work around this is genterate the options in a dynamic dropdown and then cut and paste this into a separate form outside of the grid
              and change the dropdown to a textbox and change the value with some javascript - seems like a lot of work when
              all we need is a new property in the grid builder for a dropdown -- onchange="" and then its just a couple of keystrokes and you have it finished using the freeform layout option

              i would be most grateful if you could help
              regards
              martin

              Comment


              • #8
                RE: Dropdown list filter

                martin,
                what code did you use in your document's onload event? it should be possible to change the event handling of any object through javascript; it shouldn't matter that it is part of a grid.
                - peter

                Comment


                • #9
                  RE: Dropdown list filter

                  thanx for the reply Peter

                  i still cant seem to make it work
                  i have tried it every way that i can think of

                  here are three of the latest attempts



                  this code is called with the onload event for the page


                  // reset the on change event for the CC type dropdown to allow for clearing the CC number field if the user changes the CC Type
                  var fcct = document.getElementsByName("V.R1.PAYMENT_TYPE");
                  var fccta = fcct[0]
                  // fcct[0].onchange = "clearCCNumber()";
                  // document.TordCC.elements[1].onchange = "clearCCNumber()";
                  // document.TordCC.fcca.onchange = "clearCCNumber()";

                  when the page is generated it still has the onchange property set to ""

                  if you could enlighten me as to what i am doing wrong i would be most grateful

                  thanx in adavnce
                  martin

                  Comment


                  • #10
                    RE: Dropdown list filter

                    martin,
                    when the code is generated and you "view source" for the page, you will see the code that is sent to the browser. that will include "b"onchange="""/b".
                    the onchange code is changed by javascript. you won't see that when you look at the source. you can only tell that it happens by, say, putting an alert() in the function called by onload to see what the onchange actually is, or putting an alert in the clearCCNumber() code to see if it is being called.
                    -peter

                    Comment


                    • #11
                      RE: Dropdown list filter

                      thanks again peter
                      this i wasn't sure about but just to make sue i use
                      alert boxes in the functions to make sure at least thay are called and execute.

                      in the TordCC.a5w page i have
                      in the header section:
                      "script type="text/javascript" language="javascript" src="CCValidate.js"""/script"

                      in the body:
                      "body onload="breaktele()"" thsi calles the function

                      the functions breaktele() and clearCCNumber()are in CCvalidate.js

                      here are the two functions

                      function breaktele() // get the telephone numbers and break them up and place the parts into the telparts
                      {
                      var fdaytel = document.getElementById("V.R1.PAYMENT_TELE1");
                      var daytel = fdaytel.value;
                      // alert("in breaktele- daytel---" + daytel);

                      document.TordCC.elements[17].value = daytel.substring(0, 3);
                      document.TordCC.elements[18].value = daytel.substring(4, 7);
                      document.TordCC.elements[19].value = daytel.substring(8, 12);

                      var falttel = document.getElementById("V.R1.PAYMENT_TELE2");
                      var alttel = falttel.value;

                      document.TordCC.elements[21].value = alttel.substring(0, 3);
                      document.TordCC.elements[22].value = alttel.substring(4, 7);
                      document.TordCC.elements[23].value = alttel.substring(8, 12);

                      // clearCCNumber()

                      // reset the on change event for the CC type dropdown to allow for clearing the CC number field if the user changes the CC Type
                      var fcct = document.getElementsByName("V.R1.PAYMENT_TYPE");
                      var fccta = fcct[0]
                      // fccta.onchange = "clearCCNumber()";
                      // document.TordCC.elements[1].onchange = "clearCCNumber()";
                      // document.TordCC.fccta.onchange = "clearCCNumber()";


                      }


                      function clearCCNumber()
                      {
                      // Force user to re-enter credit card number if the credit card type is changed
                      // onChange event on the credit card type select box
                      //alert("Got to clearCCNumber")
                      document.TordCC.elements[2].value = "";

                      }


                      and they are both called and can be chained but it has no effect
                      am i useing the right method for this operation and the right syntax to get the job done??????


                      thanx again for your assistance

                      blueintheface
                      martin

                      Comment


                      • #12
                        RE: Dropdown list filter

                        ok peter i attempted to get an alert box with the onchange
                        value

                        added these two alerts

                        alert("on change for dropdown---" + fccta.onchange);

                        alert(" after change attempt--on change for dropdown---" + fccta.onchange);


                        get the same response fo both:

                        on change for dropdown---
                        function(event){
                        }



                        after change attempt--on change for dropdown---
                        function(event){
                        }


                        i may not have formatted the request properly

                        but i got an undefined when i used

                        alert("on change for dropdown---" + fccta.onchange.value);
                        and the same thing for

                        alert("on change for dropdown---" + fccta.onchange.text);

                        its as clear as mud to me

                        thanx again

                        indesperateneedofminoxidil
                        martin

                        Comment


                        • #13
                          RE: Dropdown list filter

                          martin,
                          i could be wrong about this, but i think you have to change

                          // reset the on change event for the CC type dropdown to allow for clearing the CC number field if the user changes the CC Type
                          var fcct = document.getElementsByName("V.R1.PAYMENT_TYPE");
                          var fccta = fcct[0]
                          // fccta.onchange = "clearCCNumber()";
                          // document.TordCC.elements[1].onchange = "clearCCNumber()";
                          // document.TordCC.fccta.onchange = "clearCCNumber()";

                          to

                          // reset the on change event for the CC type dropdown to //allow for clearing the CC number field if the user changes //the CC Type
                          var fcct = document.getElementsByName("V.R1.PAYMENT_TYPE");
                          var fccta = fcct[0];
                          fccta.onchange = clearCCNumber;

                          i *think* that the function name should not be in quotes. i'd have to experiment to be sure; i get confused easily with javascript syntax.
                          also, since there is probably only one payment type per row, you should be able to make it

                          // reset the on change event for the CC type dropdown to //allow for clearing the CC number field if the user changes //the CC Type
                          var fccta = document.getElementById("V.R1.PAYMENT_TYPE");
                          fccta.onchange = clearCCNumber;

                          good luck,
                          peter

                          Comment


                          • #14
                            RE: Dropdown list filter

                            martin,
                            here's a simple example without a grid, showing the proper syntax for changing the onchange event of a select control in javascript:


                            "head"
                            "meta name="generator" content="Alpha Five HTML Editor""
                            "title""/title"
                            "script language="javascript" type="text/javascript""
                            function ccTypeChange(){
                            ccnmbr=document.getElementById("ccnumber");
                            ccnmbr.value="";
                            }

                            function init(){
                            cct=document.getElementById("cctype");
                            cct.onchange=ccTypeChange;
                            }

                            window.onload=init;
                            "/script"
                            "/head"
                            "body"
                            Credit Card type: "select id=cctype"
                            "option value=amex selected "American Express"/option"
                            "option value=VISA"Visa"/option"
                            "option value=MSTR"Mastercard"/option""/select""br"
                            Credit Card number:
                            "input id=ccnumber size=14""/body"


                            note also that i put a "window.onload=init" in the "head" section. Alpha Five puts its own ""body"" in when you publish the page, and if you're not careful your "body onload" can be conflict with A5's. Putting the onload code in the "head" section resolves any potential conflict.

                            - peter

                            Comment


                            • #15
                              RE: Dropdown list filter

                              ok Peter
                              youdaman
                              YUODAMAN
                              You are the man
                              and i have my sanity back
                              the syntax :

                              fccta.onchange = clearCCNumber;

                              did the trick

                              i cant tell you how much your help
                              has meant
                              thanx again

                              martin

                              Comment

                              Working...
                              X