Forum Moderators: coopster

Message Too Old, No Replies

Checkbox for more dropdowns

         

phpNewb

5:43 pm on Aug 28, 2007 (gmt 0)

10+ Year Member



Hi All-

I have a page that I want to give the user to add more than one link to... right now the default page has a title and one dropdown for a link:

<form name="frm" method="post" action="<?php echo $PHP_SELF;?>">
<INPUT TYPE="HIDDEN" NAME="resource_id" VALUE="<?php echo $resource_id;?>" SIZE="50">
<INPUT TYPE="HIDDEN" NAME="operation" VALUE="<?php echo $operation;?>">
<INPUT TYPE="HIDDEN" NAME="type_id" VALUE="<?php echo $type_id;?>">

<h1>Add / Update Resources</h1>

<table class="box_content" width="80%" border="0" cellpadding="0" cellspacing="0" >
<tbody>
<tr>
<td class="contentnovertical">
<div style="padding: 5px;">
<table border="0" cellpadding="0" cellspacing="5" width="100%">
<tbody>
<tr>
<td>* Title:</td>
<td><input name="title" value="<?php echo $title;?>" size="50" type="text"></td>
</tr>
<tr>
<td>
<span class="plain_sub_head">
<span class="formlabel">* Link Page:</span>
</span>
</td>
<td>
<select name="url" onChange="show_offsite()">
foreach( $urls as $page => $location)
{
//echo "<option>loc: ".$location;
//echo "url: ".$url."</option>";
echo "<option ";
if( $url == $location )
{
echo "SELECTED";
}
echo " VALUE=\"".$location."\">".$page."</OPTION>\n";
}
</select>
<input type="checkbox" name="add_link"> Add Another Link
</td>
</tr>
<tr>
<td>
<span id="offsite_label" style="display: none;">Offsite Link:</span>
</td>
<td>
<span id="offsite_text" style="display: none;">
<input type="text" size="40" maxlength="100" name="offsite_url" value="<?php echo $offsite_url;?>">
</span>
</td>
</tr>
<tr>
<td align='center' colspan='2' class="box_heading">&nbsp;<?php echo $section_heading;?>&nbsp;( * - required field )</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
<tr>
<td class="contentnovertical">
<div style="padding-top: 5px; padding-bottom: 5px;" nowrap="" align="center">
<input type="submit" class="submit_button" value="<?php echo $operation;?>" >
<A HREF="resources_updater.php?type_id=<?php echo $type_id;?>"><span class="content_text">Cancel</span>[/url]
</div>
</td>
</tr>
</tbody>
</table>
</form>

<script type="text/javascript">
show_offsite();
function show_offsite()
{
if (document.frm.url.value == 'offsite')
{
document.getElementById("offsite_text").style.display = "inline";
document.getElementById("offsite_label").style.display = "inline";
}
else
{
document.getElementById("offsite_text").style.display = "none";
document.getElementById("offsite_label").style.display = "none";
}
}
</script>

What I'd like to do IF THE checkbox next to the current dropdown IS CHECKED, show another dropdown under it....

All help will be greatly appreciated! So, I need assistance with: if the box checked, show another link dropdown under it (could have multiple links...).

Please let me know if I need to provide any additional information for you to help me solve this problem.

Thanks!
-j.g.

[edited by: phpNewb at 5:44 pm (utc) on Aug. 28, 2007]

henry0

6:43 pm on Aug 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unless doing multiple refreshes this looks like an Ajax task