Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8724945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:55:51+00:00 2026-06-13T07:55:51+00:00

I am trying to show a div on click of a submit button but

  • 0

I am trying to show a div on click of a submit button but when I am submitting the div is shown for the moment till the page reloads. After the page reload the div fades away. I need to stop that fading. How to do it in JavaScript?

The code is as:

<div class="main" align="center" data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Report Generation'">
      <form  action="response.jsp"  method="post">
      <h2></h2>
      <select data-dojo-type="dijit/form/ComboBox" id="sel" name="sel" required="true">
      <option value=""><---Select the Sources---></option>
      <option value="">All</option>
     <% String tss=fa.myresult();
                %>
       <option value=""><%=tss%></option>
      </select><br><br>
      <select data-dojo-type="dijit/form/ComboBox" id="linkrec" name="linkrec" required="true">
      <option value=""><---Select The Operation---></option>
      <option value="">Linkages</option>
      <option value="">Total No. of records</option>
      </select><br><br>
      <button data-dojo-type="dijit/form/Button" type="Submit" onClick=check();>Search</button></form>
      </div>
      <div class="child" id="p2" style="display:none" data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Result'">
      <%     String a1=fa.getsrc();
            String name=request.getParameter("sel");
            String src=request.getParameter("linkrec");%>
            The Selected source is ---><%=name %><br><br>
        <b>The Selected operation is--><%=src %></b><br>
        <b>The Source <%=name%> Has <%=src%>---><%=a1%></b>
        
        </div>

 <script>
      
      function check()
      {
          usersrc=document.getElementById("sel").value;
          userselect=document.getElementById("linkrec").value;
         
         if(usersrc=="<---Select the Sources--->"|| userselect=="<---Select The Operation--->")
              {
              alert("Select src and records");
              }
        else if (usersrc=="All" && userselect=="Linkages")
             {
             document.getElementById('p2').style.display ='';
             }</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:55:52+00:00Added an answer on June 13, 2026 at 7:55 am

    Just add return false to your onSubmit

    <input type="submit" name="submit" value="Save" onclick="return showdiv();"/>
    

    ** in javascript**

    function showdiv()
    {
         var error = false;
        //validate your form.
        if(error == true){ return true;}
        else
        {
           //show div
           return false;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On the click of a button, I'm trying to show a simple hidden div
I'm trying to create a standardized show/hide element system, like so: <div class=opener popup_1>Click
I am trying to hide/show/toggle a div when a button is clicked. I am
I'm trying to show a div AFTER all other animations have finished. The code
I have a form that i am trying to submit after the page loads
I am trying to call a DIV .click function, but it doesn't work. The
I'm trying to show a div when a user clicks in an input field,
I'm trying to show / hide a DIV when a user clicks on its
I'm using simple jcarousel here is ther code: http://jsfiddle.net/w6fLA/ I'm trying to show div
I am trying to use jQuery to show a div when the user selects

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.