View Single Post
  #1 (permalink)  
Old Apr 21st, 2008, 18:02
BRONIC BRONIC is offline
Junior Member
Join Date: Apr 2007
Location: Kansas
Age: 18
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to BRONIC
[SOLVED] help with checkbox and textfield in form

I am having trouble in getting this form to work.
i am trying to make sure that if the 'other' checkbox is checked and the other textbox is empty then an alert tells the user they need to fill in the box, and when the box is not checked it does nothing.


here is my form:
HTML: Select all
<script type="text/javascript">
function showHide(id){ 
   el = document.getElementById(id); 
   el.style.display = (el.style.display != 'block')? 'block' : 'none';
}
</script>

<form name="change" action="resize.php?action=change" id="change" method="POST">
	<p>Your Style: <input type='text' 	name='style'></p>
	<p>Your Bio(less than 300 words):<br><textarea name="bio" cols="100" rows"10"></textarea></p>
	<p>What categories would you like to display?<br>
	<Input type = 'Checkbox' Name ='web' value= '1'> Websites<br>
	<Input type = 'Checkbox' Name ='art' value= '1'> Traditional Artwork<br>
	<Input type = 'Checkbox' Name ='ani' value= '1'> Animations<br>
	<Input type = 'Checkbox' Name ='vid' value= '1'> Video<br>
	<Input type = 'Checkbox' Name ='pho' value= '1'> Photography<br>
	<Input type = 'Checkbox' Name ='mus' value= '1'> Music<br>
	<input name ='oth' type = 'Checkbox' onClick="showHide('other_text')" value= '1'> 
	Other<br>
    <div id="other_text" style="display:none">If other, please specify:
      <input type='text' name='other'></div>
    <p>
	</p>
	Choose a background color:<br>
	<Input type = 'Radio' Name ='color' value= 'red'> Red<br>
	<Input type = 'Radio' Name ='color' value= 'blue'> Blue<br>
	<Input type = 'Radio' Name ='color' value= 'green'> Green<br>
	<Input type = 'Radio' Name ='color' value= 'black'> Black<br>
	<Input type = 'Radio' Name ='color' value= 'grey'> Grey<br>
	<Input type = 'Radio' Name ='color' value= 'orange'> Orange<br>
	<Input type = 'Radio' Name ='color' value= 'purple'> Purple<br>
	<Input type = 'Radio' Name ='color' value= 'yellow'> Yellow<br>
  <p><input type='submit' name='Submit' value='Update Page' onClick=""></p>
</form>

here is the link to the page:
here
Reply With Quote