TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-27-2008, 12:44 AM   #1 (permalink)
The Acquainted
 
Randy's Avatar
 
Join Date: May 2007
Location: Your G/F's Closet
Posts: 114
Thanks: 7
Randy is on a distinguished road
Default 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
__________________
Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25 - Andrew Rutherford
Send a message via AIM to Randy Send a message via MSN to Randy
Randy is offline  
Reply With Quote
Old 04-27-2008, 04:57 AM   #2 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

Quote:
Originally Posted by Randy View Post
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.
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 04-27-2008, 02:20 PM   #3 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

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>
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 04-27-2008, 06:29 PM   #4 (permalink)
WebDev'n Beer Drnkn' Fool
 
stewart's Avatar
 
Join Date: Dec 2007
Location: Denver, CO
Posts: 59
Thanks: 2
stewart is on a distinguished road
Default

Very nice example there WH
__________________
stewart::howe
Web Developer & Programmer
CelerMedia.Com | iAmStewart.com | CelerLabs.com
Send a message via ICQ to stewart Send a message via AIM to stewart Send a message via MSN to stewart Send a message via Yahoo to stewart
stewart is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 06:14 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design