SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question show different forum on clik of evey different button

    m making 4 input buttons and want that when some click on any button show a different form related to that button which i want but don't know how this is excat possible

    i have seee a code where is this type of function
    but that only for one button i don't know how to change that in different buttons and different forums if anyone help m showing here that code

    PHP Code:
    <script type="text/javascript">
    function 
    changeVisibility() {
       
    document.getElementById("ez").style.visibility "visible";    
       
    document.f3.subject.disabled=false;
    }

    function 
    enableNext()
    {
       
    document.f3.email1.disabled=false;

    }
    function 
    enableNext1()
    {
       
    document.f3.message.disabled=false;

    }
    function 
    showForm( )
    {
      
    document.getElementById("bt").style.visibility "hidden";
      
    setTimeout "changeVisibility()"3000 );
    }


    </script>
    </head>
    <body >
    <div id="ez" style="position:absolute;visibility:hidden;">


    <FORM action="verify.php" method="post" name="f3" id="f3" >
        <table border="0" width="426">
          <tr>
            <td width="134">Subject:</font></td>

            <td width="276"><input type="text" name="subject" ID="subject" size="20" disabled onBlur ="enableNext();" ></td>
          </tr>
          <tr>

            <td width="134">E-mail</td>
            <td width="276"><input type="text" name="email" ID="email1" size="20" disabled  onBlur ="enableNext1();" > </td>
          </tr>
          <tr>
            <td width="134"></td>

            <td width="276"><input type="hidden" name="board" ID="board" size="5" value = '1'>  </td>
          </tr>

          <tr>
            <td width="134">Message</td>
            <td width="276"><textarea rows="8" name="message" ID="message" NAME="message" cols="32" DISABLED ="disable"> </textarea></td>
          </tr>
        </table>

        <P>
        <input type="hidden" name="id" value="5" />

    <input type="hidden" name="name" value="Ablein" />
                    
        <INPUT type="submit" value="Send"  id="sub" name="sub"> <INPUT type="reset" runat="server">    
        
     </FORM>
    </div>
    <input id="bt" name="bt" type="button" value="Submit Ad" onClick="showForm();">

    </body> 

    i need only show form on click on button mean i want to make different form show on different button

  2. #2
    SitePoint Addict
    Join Date
    Apr 2006
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd recommend that you use jquery.

    First, I'd set up each form how you like it, and put each in its own DIV. Give each div a unique ID.

    Then in the CSS, set each form div to 'display: none'

    Then set up the buttons so that when clicked, they show the form. With jquery, this is pretty simple:

    Code:
    $('#buttonID').click(function(){ 
       $('#formID').show();
    });
    You may want to set it so that the other forms are hidden when the user clicks a button. For example, if the user clicks button #2 while form #1 is visible, it hides form #1 and shows form #2. In that case you can just give each form DIV the same class and use jquery hide() all those, then show the required one.

    Hope that helps.

  3. #3
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i don't know much about JavaScript or j query i have use ur method but not successive
    i think my method is wrong can you describe me one example of form and button

  4. #4
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <html>
    <
    head>
    <
    script type="text/javascript" src="jquery-1.2.6.min.js"></script>
    </head>
    <body>
    <script type="text/javascript">
    $('#pay').click(function(){ 
       $('#pay').show();
    });

    $('#fren').click(function(){ 
       $('#fren').show();
    });
    </script>
    <input type="submit" name="pay" value="Paypal" id="pay" />
    <input type="submit" name="pay" value="Frenchise" id="fren"/>
    <div id="pay" style="display: none;">
    <form method="POST" action="done" >
    Enter Paypal ID<input name="pay" type="text" />
    </form>
    </div>

    <div id="fren" style="display: none;">
    <form method="POST" action="done" >
    Frenchise Name<input name="fren" type="text" />
    </form>
    </div>
    </body>
    </html> 
    what change need in it

  5. #5
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    answer ?

  6. #6
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <html>
    <head>
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    </head>
    <body>
    <button id="pay">Paypal</button><button id="fren">Frenchise</button>

    <form method="POST" action="done" id="pay" style="display: none;" >
    Enter Paypal ID<input name="pay" type="text" />
    </form>



    <form method="POST" action="done" id="fren" style="display: none;">
    Frenchise Name<input name="fren" type="text" />
    </form>


    <script>
    $("#pay").click(function () {
    $("#pay").show("slow");
    });
    $("#fren").click(function () {
    $("#fren").show("slow");
    });
    </script>
    </body>
    </html>



    this one is also no working even this is the same method which i read on jquery sute what's mistake in this

  7. #7
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by adwatson View Post

    You may want to set it so that the other forms are hidden when the user clicks a button. For example, if the user clicks button #2 while form #1 is visible, it hides form #1 and shows form #2. In that case you can just give each form DIV the same class and use jquery hide() all those, then show the required one.

    Hope that helps.
    i don't understand this how do i exactly show one forum in one time can u little exlain

  8. #8
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any one explain to how to automatic hdie first one if click on anny other button ????????

  9. #9
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anYOne Explain


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •