how to hide fields in the same form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madhuriks
    New Member
    • Jun 2010
    • 149

    how to hide fields in the same form

    hi,
    in my application i m using Struts2..i had designed a form..in it i m using..by clicking 'Next' button it should open other page in the same form..i need that in another page..but im not getting.Here is the code can any one provide me the solution.
    Code:
    <%@ page contentType="text/html; charset=UTF-8" %>
    <%@ taglib prefix="s" uri="/struts-tags" %>
    
    <html>
        <head>
            <title>Upload Audio Content</title>
            <script type="text/javascript" src="/Cms/js/UploadAudioContent.js"></script>
        </head>
        <body>
            <s:form action="" method="POST">
                <div id="div1">
                    <table align="center" width=610 cellspacing=0 cellpadding=3 style="border:1px solid gray">
                        <s:textfield name="ContentAudioTitle" id="UploadAudioTitle" label="ContentTitle "/>
                        <s:textfield name="ContentAudioDescription" id="UploadAudioDesc" label="ContentDescription "/>
                        <s:textfield name="ContentAudioTags" id="UploadAudioTags" label="ContentTags "/>
                        <s:textfield name="AudioExpiryDate" id="UploadAudioExpiry" label="ExpiryDate "/>
                        <s:textfield name="AudioCost" id="UploadAudioCost" label="Audio Cost "/>
                        <s:submit  type="button" value="Next" align="center" onclick="document.getElementById('div1').style.display='none'; 
     document.getElementById('div2').style.display=''; return false;"  />
                    </table>
                </div>
                <div id="div2">
                    <table align="center" width=610 cellspacing=0 cellpadding=3 style="border:1px solid gray">
                        <s:file name="AudioFile" id="UploadAudioFile" label="Audio File "/>
                        <s:select name="AudioType" id="UploadAudioType" label="Audio Type" headerKey="1" headerValue="-- Please Select --"
                                  list="#{'01':'TT','02':'PTT','03':'MP3','04':'PMP3','05':'POLY','06':'PPOLY',
                                          '07':'MONO','08':'PMONO','09':'IVR','10':'PIVR','11':'URL'}" />
                        <s:submit type="button" value="Upload" align="center" />
                    </table>
                </div>
            </s:form>
        </body>
        <Script>
            document.getElementById("div1").style.display="none";
            document.getElementById("div2").style.display="none";
        </Script>
    </html>
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    It won't show the next button if you're going to hide "div1".

    Comment

    Working...