TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Display Itesm From Form? (http://www.talkphp.com/absolute-beginners/2713-display-itesm-form.html)

Randy 04-27-2008 12:44 AM

Display Itesm From Form?
 
Hello, Yes I am creating a script (I don't want to get into details cause they aren't needed for this) and I am trying using a form with a drop down menu, I am trying to set it up for when a certain option for example "dogs" it ads one or more fields below that box, but i want it to change depending on which option is selected from the form. How might I do this?

EDIT: sorry about the mistype in the title, was watching tv for a second.

Thanks in advance.

Best Regards,
Randy Cram

sarmenhb 04-27-2008 04:57 AM

Quote:

Originally Posted by Randy (Post 13972)
Hello, Yes I am creating a script (I don't want to get into details cause they aren't needed for this) and I am trying using a form with a drop down menu, I am trying to set it up for when a certain option for example "dogs" it ads one or more fields below that box, but i want it to change depending on which option is selected from the form. How might I do this?

EDIT: sorry about the mistype in the title, was watching tv for a second.

Thanks in advance.

Best Regards,
Randy Cram

javascript, but can you reply and say more clearly what your looking for its hard to understand what you need.

Wildhoney 04-27-2008 02:20 PM

Something like this?

javascript Code:
function TalkPHP_AddFields(pTarget)
{
    var iValue = parseInt(pTarget.value);
   
    if(!iValue)
    {
        return;
    }
   
    var pP = document.getElementById('pContainer');;
    pP.innerHTML = '';
   
    for(iIndex = 0; iIndex < iValue; iIndex++)
    {
        var pInput = document.createElement('input');
        pP.appendChild(pInput);
    }
}

html4strict Code:
<select onchange="TalkPHP_AddFields(this);">

    <option value="1">Ferret</option>
    <option value="2">Cat</option>
    <option value="3">Dog</option>

</select>

<p id="pContainer">

</p>

stewart 04-27-2008 06:29 PM

Very nice example there WH ^^


All times are GMT. The time now is 02:53 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0