Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't figure out Javascript error

    Need help with the Script below. I got my radio buttons working, however...the rest of my form/webpage now won't appear. Advice? Please.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><!-- InstanceBegin template="/Templates/2009-fs2-ochdes.dwt" codeOutsideHTMLIsLocked="false" -->

    <!--#include virtual="/global/admin/2009-fs2-site-configuration.shtml" -->

    <head>
    <!-- InstanceBeginEditable name="doctitle" -->
    <title></title>
    <!-- InstanceEndEditable -->
    <!--#include virtual="/global/ssi/2009-fs2-meta-details.shtml" -->
    <!--#include virtual="/global/ssi/2009-fs2-meta-standard.shtml" -->
    <!--#include virtual="/global/ssi/2009-fs2-meta-scripts.shtml" -->
    <!-- InstanceBeginEditable name="head" -->

    <script type="text/javascript">
    if (window.addEventListener) window.addEventListener('load',init, true);
    else window.attachEvent('onload',init);

    function init()
    {
    inputs=document.forms.form1.getElementsByTagName('input');
    for(i=0;i<inputs.length;i++) if(inputs[i].type.toLowerCase()=='radio')
    {
    thisOne = inputs[i];
    radio_buttons.push(thisOne);
    thisOne.onclick=check_visibility;
    }
    fieldsets = document.forms.form1.getElementsByTagName('fieldset');
    check_visibility();
    }

    function check_visibility()
    {
    for(f=0;f<fieldsets.length;f++)
    {
    thisFieldset=fieldsets[f];
    if(thisFieldset.id==root_fieldset)checkFieldsets.push(thisFieldset);
    else thisFieldset.style.display="none";
    }
    do
    {
    checkFieldset=checkFieldsets.pop();//get an item to check
    if(typeof checkFieldset=='undefined') continue;
    inputs=checkFieldset.getElementsByTagName('input');
    if(inputs.count==0) continue;//no inputs to check
    for(i=0;i<inputs.length;i++)
    {
    if(inputs[i].type.toLowerCase()!='radio') continue;
    thisRadio=inputs[i];
    if(!thisRadio.checked) continue;
    //its a radio and its selected!
    dependants=visibility_dependancies[thisRadio.id];
    if(typeof dependants=='undefined') continue;
    if(dependants.length==0) continue;
    for(d=0; d<dependants.length;d++)
    {
    newlyVisibleFieldset=document.getElementById(dependants[d]);
    checkFieldsets.push(newlyVisibleFieldset);
    newlyVisibleFieldset.style.display='block';
    }
    }
    } while (checkFieldsets.length>0)
    }

    var radio_buttons = new Array();
    var fieldsets = new Array();
    var root_fieldset = 'Facility_Location_set';
    var checkFieldsets = new Array();

    var visibility_dependancies={
    'Facility_Location_BFR':new Array('BFR_type_set'),
    'Facility_Location_BPAS':new Array('BPAS_type_set'),
    'Facility_Location_CRES':new Array('CRES_type_set'),
    'Facility_Location_GRLD':new Array('GRLD_type_set'),
    'Facility_Location_LKMT':new Array('LKMT_type_set'),
    'Facility_Location_PAU':new Array('PAU_type_set'),
    'Facility_Location_RAC':new Array('RAC_type_set'),
    'Facility_Location_SIS':new Array('SIS_type_set')
    };

    </script>
    <style>
    fieldset{float:left; margin:0 2px;}
    label{padding-left:5px;}
    </style>
    <style type="text/css">
    #TableBorder {
    border: thin solid #000;
    }
    </style>
    <!-- InstanceEndEditable -->
    </head>

    <body>
    <!--#include virtual="/global/ssi/2009-fs2-accessibility.shtml" -->
    <div id="page-wrapper">
    <!--#include virtual="/global/ssi/2009-fs2-masthead.shtml" -->
    <!--#include virtual="/global/ssi/2009-fs2-spotlight-navigation.shtml" -->
    <div id="sidebar-wrapper" class="noprint">
    <!--#include virtual="/global/ssi/2009-fs2-site-navigation.shtml" -->
    </div><!-- CLOSE sidebar-wrapper -->

    <div id="content-wrapper">
    <!--#include virtual="/global/ssi/2009-fs2-contribute1.shtml" -->
    <!--#include virtual="/global/ssi/2009-fs2-breadcrumb.shtml" -->
    <!-- InstanceBeginEditable name="content" -->

    <h1>Report A Facility Maintenance Problem</h1>
    <!--#if expr="$QUERY_STRING = 'thankyou'" -->
    <h2>Thank You!</h2>
    <p>Thank you for reporting a Facility Maintenance Problem.
    </p>
    <!--#else -->

    <div id="contactus">
    <form name="form1" id="form1" method="post" action="<!--#echo var='sitescripts' -->email-building-maint.php" />

    <div id="emaildetails">

    <input type="hidden" name="recipient_cc" value="cc" />
    <input type="hidden" name="redirect" value="http://fsweb-ochdes.r6.fs.fed.us/eng/facilities/facility-maintenance-reporting/index.shtml?thankyou" />
    <input type="hidden" name="required" value="Name,Phone_Number,email,recipient" />
    <input type="hidden" name="subject" value="Facility Maintenance Problem Report" />
    </div>

    <p><strong>* Fields with an asterisk are required</strong></p>
    <fieldset>
    <legend>Your Contact Information</legend>
    <dl>
    <dt><label for="Name">Your Name *</label></dt>
    <dd><input class="inputtext" type="text" id="Name" name="Name" /></dd>
    <dt><label for="Phone_Number">Your Telephone Number *</label></dt>
    <dd><input class="inputtext" type="text" name="Phone_Number" id="Phone_Number" /></dd>
    <dt><label for="email">Your Email Address *</label></dt>
    <dd><input class="inputtext" type="text" name="email" id="email" /></dd>
    <dt><label for="File_Location">Supporting Documents</label></dt>
    <p>If you have any supporting documents or shape files, please provide a file path to where it is stored on the network:</p>
    <dd><input class="inputtext" type="text" name="File_Location" id="File_Location" /></dd>
    </dl>
    <p><strong>Privacy Advisory:</strong> Your personal identifying information is being requested. We need this identifying information so that we can provide what you requested, and/or to respond to your comments. Generally, personal identifying information is destroyed after we fill your request. If you do not provide the requested personal information, we will be unable to respond directly to your request or comment.</p>
    </fieldset>

    <fieldset>
    <legend>Facility Site</legend>
    <p>Please provide the Facility Site:</p>
    <dl>
    <dt><label for="recipient">Facility Site*</label></dt>
    <dd><select class="inputselect" name="recipient" id="recipient">
    <option value="" selected="selected">Select One...</option>
    <option value="bfr">Bend Fort Rock</option>
    <option value="bpas">Bend Pine Admin. Site</option>
    <option value="crescent">Crescent</option>
    <option value="GRLD">Crooked River National Grassland</option>
    <option value="LKMT">Lookout Mountain</option>
    <option value="PAU">Paulina</option>
    <option value="redmond">Redmond Air Center</option>
    <option value="sisters">Sisters</option>
    <option value="test">test</option>
    </select></dd>
    </dl>
    </fieldset>

    <fieldset id='Facility_Location_set'>
    <legend>Facility Location</legend>
    <div><input type='radio' name='Facility_Location' value='BFR' id='Facility_Location_BFR' /> Bend Fort Rock</div>
    <div><input type='radio' name='Facility_Location' value='BPAS' id='Facility_Location_BPAS' /> Bend Pine Admin. Site</div>
    <div><input type='radio' name='Facility_Location' value='CRES' id='Facility_Location_CRES' /> Crescent</div>
    <div><input type='radio' name='Facility_Location' value='GRLD' id='Facility_Location_GRLD' /> Crooked River National Grasslands</div>
    <div><input type='radio' name='Facility_Location' value='LKMT' id='Facility_Location_LKMT' /> Lookout Mountain</div>
    <div><input type='radio' name='Facility_Location' value='PAU' id='Facility_Location_PAU' /> Paulina</div>
    <div><input type='radio' name='Facility_Location' value='RAC' id='Facility_Location_RAC' /> Redmond Air Center</div>
    <div><input type='radio' name='Facility_Location' value='SIS' id='Facility_Location_SIS' /> Sisters</div>
    </fieldset>

    <fieldset id='BFR_type_set'>
    <legend>Facility Name</legend>
    <div><input type='radio' name='BFR_type' value='Fall River Guard Station' id='BFR_type_Fall River Guard Station' /> Fall River Guard Station</div>
    <div><input type='radio' name='BFR_type' value='Lavalands Vistor Center' id='BFR_type_Lavalands Vistor Center' /> Lavalands Vistor Center</div>
    <div><input type='radio' name='BFR_type' value='Lookout' id='BFR_type_Lookout' /> Lookout</div>
    <div><input type='radio' name='BFR_type' value='Paulina Lake GS' id='BFR_type_Paulina Lake GS' /> Paulina Lake GS</div>
    <div><input type='radio' name='BFR_type' value='Scott St.' id='BFR_type_Scott St.' /> Scott St.</div>
    <div><input type='radio' name='BFR_type' value='Snow Creek' id='BFR_type_Snow Creek' /> Snow Creek</div>
    <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div>
    <div>Other <input type='text' name='random_text' value='' id='Other' /></div>
    </fieldset>

    <fieldset id='BPAS_type_set'>
    <legend>Facility Name</legend>
    <div><input type='radio' name='BPAS_type' value='Coolers' id='BPAS_type_Coolers' /> Coolers</div>
    <div><input type='radio' name='BPAS_type' value='Equipment Storage Bld.' id='BPAS_type_Equipment Storage Bld.' /> Equipment Storage Bld.</div>
    <div><input type='radio' name='BPAS_type' value='Lab' id='BPAS_type_Lab' /> Lab</div>
    <div><input type='radio' name='BPAS_type' value='New Office' id='BPAS_type_New Office' /> New Office</div>
    <div><input type='radio' name='BPAS_type' value='Packing Shed' id='BPAS_type_Packing Shed' /> Packing Shed</div>
    <div><input type='radio' name='BPAS_type' value='Shop' id='BPAS_type_Shop' /> Shop</div>
    </fieldset>

    <fieldset id='CRES_type_set'>
    <legend>Facility Name</legend>
    <div><input type='radio' name='CRES_type' value='Crescent Lake G.S.' id='CRES_type_Crescent Lake G.S.' /> Crescent Lake G.S.</div>
    <div><input type='radio' name='CRES_type' value='Lookout' id='CRES_type_Lookout' /> Lookout</div>
    <div><input type='radio' name='CRES_type' value='Office Compound' id='CRES_type_Office Compound' /> Office Compound</div>
    <div><input type='radio' name='CRES_type' value='Rosedale' id='CRES_type_Rosedale' /> Rosedale</div>
    <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div>
    <div>Other <input type='text' name='random_text' value='' id='Other' /></div>
    </fieldset>

    <fieldset id='GRLD_type_set'>
    <legend>Facility Name</legend>
    <div><input type='radio' name='GRLD_type' value='Field Headquarters' id='GRLD_type_Field Headquarters' /> Field Headquarters</div>
    <div><input type='radio' name='GRLD_type' value='Lookout' id='GRLD_type_Lookout' /> Lookout</div>
    <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div>
    <div>Other <input type='text' name='random_text' value='' id='Other' /></div>
    </fieldset>

    <fieldset id='LKMT_type_set'>
    <legend>Facility Name</legend>
    <div><input type='radio' name='LKMT_type' value='Dispatch' id='LKMT_type_Dispatch' /> Dispatch</div>
    <div><input type='radio' name='LKMT_type' value='Helibase' id='LKMT_type_Helibase' /> Helibase</div>
    <div><input type='radio' name='LKMT_type' value='Lamonta' id='LKMT_type_Lamonta' /> Lamonta</div>
    <div><input type='radio' name='LKMT_type' value='Lookout' id='LKMT_type_Lookout' /> Lookout</div>
    <div><input type='radio' name='LKMT_type' value='Ochoco R.S.' id='LKMT_type_Ochoco R.S.' /> Ochoco R.S.</div>
    <div><input type='radio' name='LKMT_type' value='Ranger Rental' id='LKMT_type_Ranger Rental' /> Ranger Rental</div>
    <div><input type='radio' name='LKMT_type' value='S.O.' id='LKMT_type_S.O.' /> S.O.</div>
    </fieldset>

    <fieldset id='PAU_type_set'>
    <legend>Facility Name</legend>
    <div><input type='radio' name='PAU_type' value='Cold Spring Rental' id='PAU_type_Cold Spring Rental' /> Cold Spring Rental</div>
    <div><input type='radio' name='PAU_type' value='Lookout' id='PAU_type_Lookout' /> Lookout</div>
    <div><input type='radio' name='PAU_type' value='Rager' id='PAU_type_Rager' /> Rager</div>
    <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div>
    <div>Other <input type='text' name='random_text' value='' id='Other' /></div>
    </fieldset>

    <fieldset id='RAC_type_set'>
    <legend>Facility Name</legend>
    <div><input type='radio' name='RAC_type' value='Admin' id='RAC_type_Admin' /> Admin</div>
    <div><input type='radio' name='RAC_type' value='Air Tanker Base' id='RAC_type_Air Tanker Base' /> Air Tanker Base</div>
    <div><input type='radio' name='RAC_type' value='Barracks' id='RAC_type_Barracks' /> Barracks</div>
    <div><input type='radio' name='RAC_type' value='Cache' id='RAC_type_Cache' /> Cache</div>
    <div><input type='radio' name='RAC_type' value='Paraloft' id='RAC_type_Paraloft' /> Paraloft</div>
    <div><input type='radio' name='RAC_type' value='RAG' id='RAC_type_RAG' /> RAG</div>
    <div>Other <input type='text' name='random_text' value='' id='Other' /></div>
    </fieldset>

    <fieldset id='SIS_type_set'>
    <legend>Facility Name</legend>
    <div><input type='radio' name='SIS_type' value='Allingham' id='SIS_type_Allingham' /> Allingham</div>
    <div><input type='radio' name='SIS_type' value='Lookout' id='SIS_type_Lookout' /> Lookout</div>
    <div><input type='radio' name='SIS_type' value='Office Compound' id='SIS_type_Office Compound' /> Office Compound</div>
    <div><input type='radio' name='SIS_type' value='Portal' id='SIS_type_Portal' /> Portal</div>
    <div><input type='radio' name='SIS_type' value='Warehouse Compound' id='SIS_type_Warehouse Compound' /> Warehouse Compound</div>
    <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div>
    <div>Other <input type='text' name='random_text' value='' id='Other' /></div>
    </fieldset>

    <fieldset>
    <legend>Maintenance Area</legend>
    <dl>
    <dt><label for="Type_of_Error">Problem that you would like to Report *</label></dt>
    <dd><select class="inputselect" name="Type_of_Error" id="Type_of_Error">
    <option value="Select One">Select One ...</option>
    <option value="Doors/Locks/Gates = Access">Doors/Locks/Gates = Access</option>
    <option value="Fence">Fence</option>
    <option value="HVAC">HVAC</option>
    <option value="Lights">Lights</option>
    <option value="Restrooms">Restrooms</option>
    <option value="Windows/Blinds">Windows/Blinds</option>
    <option value="Other">Other</option>
    </select></dd>
    </dl>
    </fieldset>

    <fieldset>
    <legend>Miscellaneous Information</legend>
    <dl>
    <dt><label for="Additional_Information">Please Describe the Problem You are Reporting</label></dt>
    <dd><textarea class="inputtextarea" id="Additional_Information" name="Additional_Information" rows="11" cols="65"></textarea></dd>
    </dl>
    </fieldset>

    <fieldset>
    <legend>Send Email To Us</legend>
    <dl>
    <dt><label for="submit">Submit Form</label></dt>
    <dd><input class="inputsubmit" type="submit" id="submit" name="submit" value="Let us Know!" /></dd>
    </dl>
    </fieldset>

    </form>
    </div>

    <!--#endif -->

    <!-- InstanceEndEditable -->
    <!--#include virtual="/global/ssi/2009-fs2-contribute2.shtml" -->
    </div>
    <!-- CLOSE content-wrapper -->
    <!--#include virtual="/global/ssi/2009-fs2-footer.shtml" -->
    </div>
    <!-- CLOSE page-wrapper -->

    </body>
    <!-- InstanceEnd --></html>
    Last edited by skanknpunx; 03-01-2012 at 09:30 PM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,318
    Thanks
    203
    Thanked 2,566 Times in 2,544 Posts
    Do please read the forum rules and posting guidelines regarding silly thread titles and the use of code tags.

    As WA remarks, "There are generally two types of people- ones that simply dump their entire page or problem and expect everyone to spend hours solving everything for them, and those that do their own homework first, and only ask very specific, manageable questions. The later invariably gets more and better responses from others. When you're lazy, do not expect us to be hardworking for you."

    What steps have you taken to identify your problem? Have you tried using your error console? What error messages do you get?

    It is your responsibility to die() if necessary….. - PHP Manual

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry Phil. I am new to the Forum and have not worked with Javascript much at all. I have tried fixing it for over 4 days now. Doing my best. Any help/advice/guidance would be appreicated.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,318
    Thanks
    203
    Thanked 2,566 Times in 2,544 Posts
    Quote Originally Posted by skanknpunx View Post
    Sorry Phil. I am new to the Forum and have not worked with Javascript much at all. I have tried fixing it for over 4 days now. Doing my best. Any help/advice/guidance would be appreicated.
    For advice See post #2.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #5
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Code:
    for(f=0;f<fieldsets.length;f++)
    {
    thisFieldset=fieldsets[f]; 
    if(thisFieldset.id==root_fieldset)checkFieldsets.push(thisFieldset); 
    else thisFieldset.style.display="none";
    }
    That code hides all <fieldset>s except 'Facility_Location_set', including the rest of your form. What do you expect?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •