WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder



Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Show hide table rows to make dynamic forms
Categories : Beginner Guides, Java Script, Form Processing, HTTP
bastien koert
Date : Jun 24th 2005
Grade : 2 of 5 (graded 25 times)
Viewed : 87480
File : No file for this code example.
Images : No Images for this code example.
Search : More code by bastien koert
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

Here is an example of using dynamic forms with javscript to make an adaptable form that can change based on user input

<html>
<head>
<title>Demo</title>
<script language="javascript">
  function show_row(){
    // Make sure the element exists before calling it's properties
    if ((document.getElementById("police_response1") != null)&&(document.getElementById("police_response2") != null))
      // Toggle visibility between none and inline
      if ((document.getElementById("police_response1").style.display == 'none')&&(document.getElementById("police_response2").style.display == 'none'))
      {
        document.getElementById("police_response1").style.display = 'inline';
        document.getElementById("police_response2").style.display = 'inline';
          document.getElementById("Inc_Police_Called").checked = true;
      } else {
        document.getElementById("police_response1").style.display = 'none';
        document.getElementById("police_response2").style.display = 'none';
          document.getElementById("Inc_Police_Called").checked = false;
      }
  }
</script>
<body>
<form name="test" action="" method="post">
<table>
<tr>
  <td width="50%" align="right" height="23" valign="top">Police Notified:</td>
  <td height="23" >
    <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>
     <TR>
       <TD><INPUT TYPE='radio' NAME='Inc_Police_Called' ID='Inc_Police_Called' VALUE='1' onClick="show_row();">Yes</TD>
       <TD><INPUT TYPE='radio' NAME='Inc_Police_Called' ID='Inc_Police_Called' VALUE='0' onClick="show_row();">No</TD>
     </TR>
   </TABLE>
  </td>
</tr>
<tr id="police_response1" name="police_response1" style="display:inline;">
  <td align="right">Response Time:</td>
  <td>
    <SELECT NAME='Incident_Police_Response' ID='Incident_Police_Response'>
        <option value='00'>00</option>
        <option value='05'>05</option>
        <option value='10'>10</option>
        <option value='15'>15</option>
        <option value='20'>20</option>
        <option value='25'>25</option>
        <option value='30'>30</option>
        <option value='35'>35</option>
        <option value='40'>40</option>
        <option value='45'>45</option>
        <option value='50'>50</option>
        <option value='55'>55</option>
        <option value='60'>60</option>
        <option value='75'>75</option>
        <option value='90'>90</option>
        <option value='105'>105</option>
        <option value='120'>120</option>
      </SELECT>
   </td>
</tr>
<tr id="police_response2" name="police_response2" style="display:inline;">
  <td align="right">Report Number:</td>
  <td><INPUT TYPE='textbox' SIZE='15' NAME='inc_police_report_num' ID='inc_police_report_num' VALUE='745656'></td>
</tr>
</table>
</form>
</body>
</html>



Conditional Check - a script that allows a user to submit a form only if the user check a checkbox.
Categories : HTML, Java Script, Form Processing, Beginner Guides
PHP and javascript mouseover, mouseout, and mousedown events
Categories : PHP, Java Script, Form Processing, Beginner Guides
Changing the Style of form objects using the JavaScript OnClick method.
Categories : Java Script, Form Processing, Beginner Guides, CSS
JavaScript dropdown list menu to switch any page.
Categories : Java Script, Beginner Guides, Form Processing
Form Processing : with alert Highlight field name which is not filled by user
Categories : Java Script, Form Processing, Data Validation, Beginner Guides, Web Design
Validating a URL with JavaScript RegExp
Categories : Java Script, Data Validation, Beginner Guides
Newbie Notes #9 - Hyperlinking a post
Categories : PHP, Java Script, HTML and PHP, Beginner Guides
Easy alert box pop-up function
Categories : PHP, Java Script, Beginner Guides
Simple Javascript CSS Digital Clock
Categories : Java Script, Date Time, CSS, Beginner Guides, Web Design
Show or Hide your Content using Javascript
Categories : Java Script, HTML, CSS, Beginner Guides
Run a function once per session.
Categories : Beginner Guides, Java Script, Cookies
Fancy Quick Access Navigation Link
Categories : Java Script, Navigation, User Interface, DHTML, Beginner Guides
Form validations using javascript and including all validations in one message
Categories : HTML and PHP, Java Script, Form Processing
Show and Hide Tables, Table Rows, Form Elements Etc.
Categories : Java Script, Beginner Guides
showing Help (assistance) to the user while filling html forms.
Categories : HTML, Java Script, Form Processing
 Brian Tafoya wrote : 1330
Good thinking... just be warning this is only IE comparable. :)
 
 bastien koert wrote :1331
Tafoya Brian,

Did you try it on FF? Since it works just great, I am not sure what mean about `it only works on IE`