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

Show/hide control on dialog component not working

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

    Show/hide control on dialog component not working

    I have a dialog component which is part of an online quiz. Each component has 10 questions (Question1, Question2...). There are 10 "Choice" field radio buttons (Choice1, Choice2) which contain the 4 choices for each question. Since this is a quiz, users will be allowed to see the answers if they want. So there are 10 "Show" radio buttons which are Yes or No (default is No for each one).
    The answers (yep you guessed it: Answer1, Answer2...) should be hidden unless the user clicks on Yes in the "Show" area for a particular question. So Question5 has Choice5 below it, and below that Show5 (defaulting to No). For Answer5, I have Show5 = 'Yes' as the Show/Hide expression, but it ain't working.
    Since the quiz has 60 questions, I actually have 6 dialog components on 6 different pages, and each component is only hiding the first Answer on each page; the other nine answers are visible, even though I believe I have the correct syntax.
    The A5W pages with the dialog components only have the component and a header image and a background color html code.
    Any idea what is causing this behavior?

    Thanks,
    Jay Talbott
    Jay Talbott
    Lexington, KY


    #2
    Re: Show/hide control on dialog component not working

    I've seen this problem when using my normal method to insert a header.a5w page using a5w_include().

    Check your A5W page source in the browser. See if you have more than one set of html/head tags, perhaps because you have a header page using a5w_include(). If so, work that page to ensure you have only one set of tags and that the javascript links are in the appropriate place.
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: Show/hide control on dialog component not working

      Jay,

      Are you using any of the layout functions, especially the merge fields function? Merged fields require special handling to hide.

      Also, are the radio buttons type character or logical? For your formula, the would need to be character (Yes/No), and be careful about capitalization.

      Pat
      Pat Bremkamp
      MindKicks Consulting

      Comment


        #4
        Re: Show/hide control on dialog component not working

        Remember - everthing with show/hide is either true or false not = to or <> than.

        iif(show5='Yes',true,false)

        and remember no double quotes and watch for case UpPerCaSe is not uppercase.

        Peter
        Insanity: doing the same thing over and over again and expecting different results.
        Albert Einstein, (attributed)
        US (German-born) physicist (1879 - 1955)

        Comment


          #5
          Re: Show/hide control on dialog component not working

          Patricia and Pete:

          Thanks so much for your advice. No, I am not using any of the layout functions. I have been very careful about my CaPitaliZation.

          The iif(show5='Yes',true,false) seems to have solved the problem (after deleting cached pages). I just assumed that show5='Yes" was sufficient, but it appears that it is not. And we all know what happens when one assumes (grin).

          I appreciate your assistance.
          Jay
          Jay Talbott
          Lexington, KY

          Comment


            #6
            Re: Show/hide control on dialog component not working

            I might have spoken a bit too soon.
            Most of the time, the first page loads fine (hidden fields remain hidden).
            On the second page, the first control remains hidden while the remaining 9 controls are shown (but they should not be).
            If I hit Control-Refresh and reload the page, all the controls which should be hidden are hidden.
            Why does it take a page refresh to get the controls hidden?

            The offending page is located here . Just keep hitting the submit button (unless you want to a little cranial exercise).

            Thanks for the help.
            Jay
            Jay Talbott
            Lexington, KY

            Comment


              #7
              Re: Show/hide control on dialog component not working

              you need to dim the variable and clear it Show=.f. in the validate (server event) - you should not have to do it, is may be a bug - but that's why we call them "work arounds"
              Insanity: doing the same thing over and over again and expecting different results.
              Albert Einstein, (attributed)
              US (German-born) physicist (1879 - 1955)

              Comment


                #8
                Re: Show/hide control on dialog component not working

                Pete,
                I put this on the Initialize event.
                currentForm.Controls.Show11.value="No"
                currentForm.Controls.Show12.value="No"
                currentForm.Controls.Show13.value="No"
                currentForm.Controls.Show14.value="No"
                currentForm.Controls.Show15.value="No"
                currentForm.Controls.Show16.value="No"
                currentForm.Controls.Show17.value="No"
                currentForm.Controls.Show18.value="No"
                currentForm.Controls.Show19.value="No"
                currentForm.Controls.Show20.value="No"

                The Validate event doesn't fire until the form is submitted. I want the user to be able to see the answer on a question by question basis.

                Usually the first question on each page works OK. The answers to the other nine questions show (they should not, as the default is 'No'). If I refresh the page, the answers all disappear. I was hoping the Initialize event would solve this.

                The problem is evident http://webapps.alpha5host.com/math_quiz.a5w and the subsequent page (hit the submit button at the bottom).
                Thanks for your time.
                Jay
                Jay Talbott
                Lexington, KY

                Comment


                  #9
                  Re: Show/hide control on dialog component not working

                  By looking at the source for your web page, I can see you only have the show/hide field enabled for the first four fields. Do you actually have it for all 10 questions on the dialog?
                  Steve Wood
                  See my profile on IADN

                  Comment


                    #10
                    Re: Show/hide control on dialog component not working

                    Originally posted by Steve Wood View Post
                    By looking at the source for your web page, I can see you only have the show/hide field enabled for the first four fields. Do you actually have it for all 10 questions on the dialog?
                    I had removed it from the other 6 questions to try various solutions, (I did enable the show/hide field for all answers on the first page now) but the real offense is evident on the second page (hit submit at the bottom of the first page). Only the first answer is hidden, the other nine show. If you hit page refresh, all 10 are hidden.

                    It seems to consistently hide all answers if the page is refreshed (or if you navigate away from the page and back to it again).

                    Thanks again for your time and assistance.
                    Jay
                    Jay Talbott
                    Lexington, KY

                    Comment


                      #11
                      Re: Show/hide control on dialog component not working

                      I notice it takes 8 seconds going from page 1 to page 2, but only 3 seconds to refresh page 2. So what is the code on the big button at the bottom of page 1? Or, perhaps the code in the Initalize event on the page 2 dialog.

                      Something is causing the page to not load completely on the first attempt. The page appears to work fine when I test it both on initial load, and reload (Jay sent me a copy).
                      Steve Wood
                      See my profile on IADN

                      Comment


                        #12
                        Re: Show/hide control on dialog component not working

                        Originally posted by Steve Wood View Post
                        I notice it takes 8 seconds going from page 1 to page 2, but only 3 seconds to refresh page 2. So what is the code on the big button at the bottom of page 1?
                        dim cid as c
                        dim tbl as p
                        dim session.__protected__user as c
                        dim session.__protected__trx as c
                        dim session.__protected__email as c
                        tbl=table.open("[PathAlias.ADB_Path]\responses.dbf")
                        tbl.enter_begin(.t.)
                        tbl.Name = session.__protected__user
                        tbl.Email = session.__protected__email

                        tbl.Q1_response = CurrentForm.Controls.RadioButton1.value
                        tbl.Q1_key = CurrentForm.Controls.Key1.value
                        tbl.Q1_correct = if(tbl.q1_response=CurrentForm.Controls.Key1.value,.t.,.f.)
                        tbl.Q1_code = CurrentForm.Controls.Code1.value

                        tbl.Q2_response = currentForm.Controls.RadioButton2.value
                        tbl.Q2_key = CurrentForm.Controls.Key2.value
                        tbl.Q2_correct = if(tbl.q2_response=CurrentForm.Controls.Key2.value,.t.,.f.)
                        tbl.Q2_code = CurrentForm.Controls.Code2.value

                        tbl.Q3_response = currentForm.Controls.RadioButton3.value
                        tbl.Q3_key = CurrentForm.Controls.Key3.value
                        tbl.Q3_correct = if(tbl.q3_response=CurrentForm.Controls.Key3.value,.t.,.f.)
                        tbl.Q3_code = CurrentForm.Controls.Code3.value

                        tbl.Q4_response = currentForm.Controls.RadioButton4.value
                        tbl.Q4_key = CurrentForm.Controls.Key4.value
                        tbl.Q4_correct = if(tbl.q4_response=CurrentForm.Controls.Key4.value,.t.,.f.)
                        tbl.Q4_code = CurrentForm.Controls.Code4.value

                        tbl.Q5_response = currentForm.Controls.RadioButton5.value
                        tbl.Q5_key = CurrentForm.Controls.Key5.value
                        tbl.Q5_correct = if(tbl.q5_response=CurrentForm.Controls.Key5.value,.t.,.f.)
                        tbl.Q5_code = CurrentForm.Controls.Code5.value

                        tbl.Q6_response = currentForm.Controls.RadioButton6.value
                        tbl.Q6_key = CurrentForm.Controls.Key6.value
                        tbl.Q6_correct = if(tbl.q6_response=CurrentForm.Controls.Key6.value,.t.,.f.)
                        tbl.Q6_code = CurrentForm.Controls.Code6.value

                        tbl.Q7_response = currentForm.Controls.RadioButton7.value
                        tbl.Q7_key = CurrentForm.Controls.Key7.value
                        tbl.Q7_correct = if(tbl.q7_response=CurrentForm.Controls.Key7.value,.t.,.f.)
                        tbl.Q7_code = CurrentForm.Controls.Code7.value

                        tbl.Q8_response = currentForm.Controls.RadioButton8.value
                        tbl.Q8_key = CurrentForm.Controls.Key8.value
                        tbl.Q8_correct = if(tbl.q8_response=CurrentForm.Controls.Key8.value,.t.,.f.)
                        tbl.Q8_code = CurrentForm.Controls.Code8.value

                        tbl.Q9_response = currentForm.Controls.RadioButton9.value
                        tbl.Q9_key = CurrentForm.Controls.Key9.value
                        tbl.Q9_correct = if(tbl.q9_response=CurrentForm.Controls.Key9.value,.t.,.f.)
                        tbl.Q9_code = CurrentForm.Controls.Code9.value

                        tbl.Q10_response = currentForm.Controls.RadioButton10.value
                        tbl.Q10_key = CurrentForm.Controls.Key10.value
                        tbl.Q10_correct = if(tbl.q10_response=CurrentForm.Controls.Key10.value,.t.,.f.)
                        tbl.Q10_code = CurrentForm.Controls.Code10.value

                        tbl.enter_end()

                        session.__protected__trx=tbl.Transaction

                        response.redirect("math_quiz1.a5w")
                        end



                        The code on the initalize on page 2 is:

                        currentForm.Controls.Show11.value="No"
                        currentForm.Controls.Show12.value="No"
                        currentForm.Controls.Show13.value="No"
                        currentForm.Controls.Show14.value="No"
                        currentForm.Controls.Show15.value="No"
                        currentForm.Controls.Show16.value="No"
                        currentForm.Controls.Show17.value="No"
                        currentForm.Controls.Show18.value="No"
                        currentForm.Controls.Show19.value="No"
                        currentForm.Controls.Show20.value="No"


                        although I just added this last night. I had no code on the Initialize event prior to that, and the load time was still the same as you inidicated above.

                        Thanks again.
                        Jay
                        Jay Talbott
                        Lexington, KY

                        Comment


                          #13
                          Re: Show/hide control on dialog component not working

                          The next obvious suggestion is to see if this bit of code is causing the problem when the next page loads. So comment it all out except the response.redirect line. I would not suspect so, but isolating the problem is the most important thing to do. The only reason I suggest it is that a) the page works on reload, b) it works fine on my server where I left out the code that proceeds the page being loaded.

                          If it does fix the problem, then there are some cleanup items in your code that might help:

                          - In a dialog, you should use CurrentForm.RedirectTarget = "Page1.a5w" syntax rather than response.redirect().

                          - You are't closing your table with tbl.close().
                          - You might try adding tbl.batch_begin()..batch_end() around your enter commands. See the Help on that command.

                          - This line is a bit scary:
                          Code:
                          tbl.Q2_correct = if(tbl.q2_response=CurrentForm.Controls.Key2.value,.t.,.f.)
                          You mean you have the correct answers to each question in the same table where you are storing the user's answers to the questions? Maybe since you already have the table open, that's effecient; but it would be useful to lookup the answers in a single-record answer table. More flexible also for when you have multiple quizzes. It also may be possible to get the answer right on your dialog by parsing the AnsXX field value. I'd at least see if this line is causing any performance problems.

                          - Although it won't help with performance, this quiz dialog should get to the point where you have ONE dialog that serves up the questions, multiple choice answers and the correct answer all from a "quiz setup table". The way you are approaching it you will need to manually create one dialog for each 10 questions for each quiz.
                          Steve Wood
                          See my profile on IADN

                          Comment


                            #14
                            Re: Show/hide control on dialog component not working

                            Steve,
                            I did the following:

                            commented out all code except the response.redirect line.
                            used CurrentForm.RedirectTarget = "Page1.a5w" syntax rather than response.redirect() as you recommended.
                            I also realized that I had iif(show1='Yes',true,false) so I changed it to iif(Show1='Yes',true,false) (note capitalization)

                            The result is still the same. If I refresh the page, everything is fine. Is there a page.reload() or this.reload() command, or something that could force the page to reload automatically without looking too bad?

                            Thanks
                            Jay
                            Jay Talbott
                            Lexington, KY

                            Comment


                              #15
                              Re: Show/hide control on dialog component not working

                              In IE there is a setting under Tools > Options > Browser Settings where you can tell the browser to "always check for newer versions" of the page. If set that, all of your pages work perfectly. If not, I get the incomplete load problem. So that must be it, incomplete page load. There must be some javascript that will auto reload the page. It has to be javascript because the server could not tell the browser when to force a reload. Or, perhaps there is some javascript that will detect or prohibit incomplete page loads.

                              If you want to try a really goofy idea, put some dynamic content on the page, the server date and time for instance. If that really is a goofy idea, don't tell anyone I suggested it.
                              Steve Wood
                              See my profile on IADN

                              Comment

                              Working...
                              X