www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > ASP

    ASP Discussion and technical support for using and deploying Active Server Pages.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 11-01-2009, 06:27 PM
    Low Society Low Society is offline
    Registered User
     
    Join Date: Oct 2009
    Posts: 4
    How do I show or hide DIV based on ASP field value?

    Hi,
    I have created a user form in which visitors can fill in sections, some of which are hidden or displayed using the onclick to trigger a DIV to display or hide then submit the results to a database using ASP. All works fine with that, however...

    I have created another page which retrieves the results for an individual's form submission, and I want to hide the sections that were not completed (hidden when submitted).

    How can I get my page to hide or show DIVs, depending on the value retrieved from a particular field within the database?

    i.e. if Question1Response="A", show Div ID="A Section"
    If Question1Response="B", show Div ID="B Section" etc.

    Hope this makes sense. Any help would be gratefully received.

    Thanks,
    Low Society
    Reply With Quote
      #2  
    Old 11-05-2009, 07:27 AM
    gil davis's Avatar
    gil davis gil davis is offline
    Nobody important
     
    Join Date: Nov 2002
    Posts: 4,434
    Code:
    <%
    function showDiv(ans)
      if Question1Response = ans then
        showDiv = "inline" ' or block
      else
        showDiv = "none"
    end function %>
    <div id="A_Section" style="display: <%=showDiv("A")%>">
    ...
    </div>
    BTW, I don't think it is valid to use identifiers containing the space character in HTML.
    Reply With Quote
      #3  
    Old 11-05-2009, 06:31 PM
    Low Society Low Society is offline
    Registered User
     
    Join Date: Oct 2009
    Posts: 4
    Thank you

    Thank you very much for your help. I won't get the opportunity to try your solution until next week, but I'm encouraged by your suggested solution to my problem.

    I really appreciate your help. Thanks again,
    Gary
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 05:35 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.