View Single Post
  #7 (permalink)  
Old Apr 22nd, 2008, 15:26
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
Re: help with checkbox and textfield in form

HTML: Select all
<script type="text/javascript">
function showHide(id){ 
   el = document.getElementById(id); 
   el.style.display = (el.style.display != 'block')? 'block' : 'none';
}
function check(form)
    if(document.getElementById('other_check').checked && (document.getElementById('other_textbox').value || '').length <= 0) {
         alert('The box labeled "Other" was checked but you didn\'t enter a category into the text box');
    else {
        form.submit();
    }
}
</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="70" rows"50"></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' id="other_check" onClick="showHide('other_text')" value= '1'> 
    Other<br>
    <div id="other_text" style="display:none">If other, please specify:
      <input type='text' id="other_textbox" 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="try{ check(this.form); }catch(e){}; return false;"></p>
</form>

Last edited by spinal007; Apr 22nd, 2008 at 15:59.
Reply With Quote