Results 1 to 9 of 9

Thread: [RESOLVED] Need Help to this case ...

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    47

    Resolved [RESOLVED] Need Help to this case ...

    Hello, I have some problem...

    Example, I have questions :
    1.
    a. Do you have a car ? ( ) Yes ( ) No ( ) Not Answer
    b. If Yes, Do you want to sell your car if your car is damaged ? ( ) Yes ( ) No

    If I choose 1a, YES, then question 1b will appear, otherwise, it will dissapear (like hidden ...)

    Is there any sollutions...(Because there are some people which choose 1a, No and Answer 1b too, if i don't handle this problem)?

    Thank you for your answers...

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: Need Help to this case ...

    Maybe something like...

    Code:
    <form action="" method="post">
        Do you have a car? 
        <input type="radio" name="car" value="yes" 
            onclick="this.form.sellDamaged[0].disabled=false; this.form.sellDamaged[1].disabled=false;" /> Yes 
        <input type="radio" name="car" value="no" 
            onclick="this.form.sellDamaged[0].disabled=true; this.form.sellDamaged[1].disabled=true;" /> No <br />
    
        Do you want to sell your car if your car is damaged?
        <input type="radio" name="sellDamaged" value="yes" /> Yes 
        <input type="radio" name="sellDamaged" value="no" /> No <br />
    
    </form>
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    47

    Re: Need Help to this case ...

    Thank you,
    but Can you make it not visible ???

  4. #4
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: Need Help to this case ...

    Try putting the relevant portion within a DIV, give it an ID, and then use the same method I showed to toggle it's .visibility.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    47

    Re: Need Help to this case ...

    can you give example ???

  6. #6
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: Need Help to this case ...

    I only tested it in IE 6 and the latest Firefox, not sure what browsers it'll work in:

    Code:
    <html>
    <head>
        <title></title>
        <style type="text/css">
    
        </style>
        <script type="text/javascript">
            function hideIt(theElement) {
                document.getElementById(theElement).style.visibility = 'hidden';
            }
        </script>
    </head>
    <body onload="hideIt('sellDamagedDIV');">
    <form action="" method="post">
        Do you have a car? 
        <input type="radio" name="car" value="yes" 
            onclick="document.getElementById('sellDamagedDIV').style.visibility = 'visible';" /> Yes 
        <input type="radio" name="car" value="no" 
            onclick="document.getElementById('sellDamagedDIV').style.visibility = 'hidden';" /> No <br />
    
        <div id="sellDamagedDIV">
            Do you want to sell your car if your car is damaged?
            <input type="radio" name="sellDamaged" value="yes" /> Yes 
            <input type="radio" name="sellDamaged" value="no" /> No <br />
        </div>
    
    </form>
    
    </body>
    </html>
    My evil laugh has a squeak in it.

    kristopherwilson.com

  7. #7

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    47

    Re: Need Help to this case ...

    WOW...
    THANK YOU VERY MUCH.....

    But Why I can't take it to table ...?
    Like :

    <div id='P6b'>
    <tr>
    <td width=5% align='right' class="Header" ></td>
    <td width=53% class="Header" ></td>
    <td class="Header" width=14% ><input name='Opt6b' type='radio' value=0 >xxxxxx</td>
    <td class="Header" width=14%><input name='Opt6b' type='radio' value=1 >xxxxxx</td>
    <td class="Header" width=14%><input name='Opt6b' type='radio' value=2>xxxxxx</td>
    </tr>
    </div>


    b) Sorry, another question....
    If I have Table (Mysql) with "TEXT" type, Why I can't show it to next line when there is a character "Return / Enter" with PHP (Only one line...,There should be 2 line or more) ???

  8. #8
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: Need Help to this case ...

    I don't know...it works fine for me in IE and Firefox. Are you sure you changed the code from sellDamagedDIV to P6b?

    For your TEXT field, you're going to want to do something like this:

    Code:
    echo nl2br($result['fieldName']);
    This will add the html tag <br /> where newline characters are present.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  9. #9
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: Need Help to this case ...

    Ah, you have to have the entire table within the DIV, not just part of it, ie:

    Code:
    <div>
    <table>
    ...
    </table>
    </div>
    as opposed to:

    Code:
    <table>
    <div>
    ...
    </div>
    </table>
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

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



Click Here to Expand Forum to Full Width