SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2010
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need javasript or function from 3rd party browser to IE8

    I have forms that use javascript to hide sections. The form resides in a 3rd party browser. The 3rd party browser will not read the print stylesheest, therefore to print, the form must be opened outside this browser in IE8.



    How do I keep the sections hidden when opened in another browser?

    Code JavaScript:
    function validateArd2()
    {
    	if (!ensureAllTextFieldsAreFilled('ard2date', 'tf1', 'tf2'))
    		return false;
     
    	// Number of curriculum areas to be evaluated
    	if (!ensureOneRadioButtonIsChecked('R1a', 'R1b', 'R1c', 'R1d', 'R1e', 'R1f', 'R1g', 'R1h', 'R1i', 'R1j'))
    		return false;
     
    	// determine how many curriculum areas are to be evaluated, and validate accordingly
    	if (isCheckboxOrRadioButtonSelected('R1b')) // 1 curr area
    	{
    		if (!ensureCurriculumAreaValid_IsValid('1'))
    			return false;
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1c')) // 2 curr areas
    	{
    		if (!ensureCurriculumAreaValid_IsValid('1'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('2'))
    			return false;
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1d')) // 3 curr areas
    	{
    		if (!ensureCurriculumAreaValid_IsValid('1'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('2'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('3'))
    			return false;
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1e')) // 4 curr areas
    	{
    		if (!ensureCurriculumAreaValid_IsValid('1'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('2'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('3'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('4'))
    			return false;
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1f')) // 5 curr areas
    	{
    		if (!ensureCurriculumAreaValid_IsValid('1'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('2'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('3'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('4'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('5'))
    			return false;
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1g')) // 6 curr areas
    	{
    		if (!ensureCurriculumAreaValid_IsValid('1'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('2'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('3'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('4'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('5'))
    			return false;		
    		if (!ensureCurriculumAreaValid_IsValid('6'))
    			return false;
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1h')) // 7 curr areas
    	{
    		if (!ensureCurriculumAreaValid_IsValid('1'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('2'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('3'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('4'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('5'))
    			return false;		
    		if (!ensureCurriculumAreaValid_IsValid('6'))
    			return false;		
    		if (!ensureCurriculumAreaValid_IsValid('7'))
    			return false;
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1i')) // 8 curr areas
    	{
    		if (!ensureCurriculumAreaValid_IsValid('1'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('2'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('3'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('4'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('5'))
    			return false;		
    		if (!ensureCurriculumAreaValid_IsValid('6'))
    			return false;		
    		if (!ensureCurriculumAreaValid_IsValid('7'))
    			return false;		
    		if (!ensureCurriculumAreaValid_IsValid('8'))
    			return false;
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1j')) // 9 curr areas
    	{
    		if (!ensureCurriculumAreaValid_IsValid('1'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('2'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('3'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('4'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('5'))
    			return false;		
    		if (!ensureCurriculumAreaValid_IsValid('6'))
    			return false;		
    		if (!ensureCurriculumAreaValid_IsValid('7'))
    			return false;		
    		if (!ensureCurriculumAreaValid_IsValid('8'))
    			return false;
    		if (!ensureCurriculumAreaValid_IsValid('9'))
    			return false;
    	}
    	// End Curriculum Area		
     
    	return true;
    }
     
    function ensureCurriculumAreaValid_IsValid (id)
    {
    	if (!ensureAllTextFieldsAreFilled('A'+id+'tf1'))
    		return false;
     
    	if (!ensureOneTextFieldIsFilled('A'+id+'tf2', 'A'+id+'tf3'))		
    		return false;
     
    	// assessments
    	if (!ensureOneRadioButtonIsChecked('A'+id+'R1a', 'A'+id+'R1b'))
    		return false;
    	dropdown = getSelectForElement('A'+id+'op1');
    	if (dropdown)
    	{
    		if (dropdown.value == '1') // paragraph format
    		{
    			if (!ensureAllTextAreasAreFilled('A'+id+'P1'))
    				return false;
    		}
    		else if (dropdown.value == '2') // bullet format
    		{
    			if (!ensureOneTextFieldIsFilled('A'+id+'tf4', 'A'+id+'tf5', 'A'+id+'tf6', 'A'+id+'tf7', 'A'+id+'tf8', 'A'+id+'tf9', 'A'+id+'tf10', 'A'+id+'tf11', 'A'+id+'tf12', 'A'+id+'tf13', 'A'+id+'tf14', 'A'+id+'tf15', 'A'+id+'tf16', 'A'+id+'tf17', 'A'+id+'tf18'))
    				return false;
    		}
    	}
     
    	// assignments
    	if (!ensureOneRadioButtonIsChecked('A'+id+'R2a', 'A'+id+'R2b'))
    		return false;	
    	dropdown = getSelectForElement('A'+id+'op2');
    	if (dropdown)
    	{
    		if (dropdown.value == '1') // paragraph format
    		{
    			if (!ensureAllTextAreasAreFilled('A'+id+'P2'))
    				return false;
    		}
    		else if (dropdown.value == '2') // bullet format
    		{
    			if (!ensureOneTextFieldIsFilled('A'+id+'tf19', 'A'+id+'tf20', 'A'+id+'tf21', 'A'+id+'tf22', 'A'+id+'tf23', 'A'+id+'tf24', 'A'+id+'tf25', 'A'+id+'tf26', 'A'+id+'tf27', 'A'+id+'tf28', 'A'+id+'tf29', 'A'+id+'tf30', 'A'+id+'tf31', 'A'+id+'tf32', 'A'+id+'tf33'))
    				return false;
    		}
    	}
     
    	// adapted instructions
    	dropdown = getSelectForElement('A'+id+'op3');
    	if (dropdown)
    	{
    		if (dropdown.value == '1') // paragraph format
    		{
    			if (!ensureAllTextAreasAreFilled('A'+id+'P3'))
    				return false;
    		}
    		else if (dropdown.value == '2') // bullet format
    		{
    			if (!ensureOneTextFieldIsFilled('A'+id+'tf34', 'A'+id+'tf35', 'A'+id+'tf36', 'A'+id+'tf37', 'A'+id+'tf38', 'A'+id+'tf39', 'A'+id+'tf40', 'A'+id+'tf41', 'A'+id+'tf42', 'A'+id+'tf43', 'A'+id+'tf44', 'A'+id+'tf45', 'A'+id+'tf46'))
    				return false;
    		}
    	}
     
    	// adapted materials
    	dropdown = getSelectForElement('A'+id+'op4');
    	if (dropdown)
    	{
    		if (dropdown.value == '1') // paragraph format
    		{
    			if (!ensureAllTextAreasAreFilled('A'+id+'P4'))
    				return false;
    		}
    		else if (dropdown.value == '2') // bullet format
    		{
    			if (!ensureOneTextFieldIsFilled('A'+id+'tf47', 'A'+id+'tf48', 'A'+id+'tf49', 'A'+id+'tf50', 'A'+id+'tf51', 'A'+id+'tf52', 'A'+id+'tf53', 'A'+id+'tf54'))
    				return false;
    		}
    	}	
     
    	// behavior interventions
    	dropdown = getSelectForElement('A'+id+'op5');
    	if (dropdown)
    	{
    		if (dropdown.value == '1') // paragraph format
    		{
    			if (!ensureAllTextAreasAreFilled('A'+id+'P5'))
    				return false;
    		}
    		else if (dropdown.value == '2') // bullet format
    		{
    			if (!ensureOneTextFieldIsFilled('A'+id+'tf55', 'A'+id+'tf56', 'A'+id+'tf57', 'A'+id+'tf58', 'A'+id+'tf59', 'A'+id+'tf60', 'A'+id+'tf61', 'A'+id+'tf62', 'A'+id+'tf63', 'A'+id+'tf64', 'A'+id+'tf65', 'A'+id+'tf66', 'A'+id+'tf67'))
    				return false;
    		}
    	}
     
    	// assistive technology
    	dropdown = getSelectForElement('A'+id+'op6');
    	if (dropdown)
    	{
    		if (dropdown.value == '1') // paragraph format
    		{
    			if (!ensureAllTextAreasAreFilled('A'+id+'P6'))
    				return false;
    		}
    		else if (dropdown.value == '2') // bullet format
    		{
    			if (!ensureOneTextFieldIsFilled('A'+id+'tf68', 'A'+id+'tf69', 'A'+id+'tf70', 'A'+id+'tf71', 'A'+id+'tf74', 'A'+id+'tf75', 'A'+id+'tf76'))
    				return false;
    		}
    	}
     
    	// program modifications - general ed
    	dropdown = getSelectForElement('A'+id+'op7');
    	if (dropdown)
    	{
    		if (dropdown.value == '1') // paragraph format
    		{
    			if (!ensureAllTextAreasAreFilled('A'+id+'P7'))
    				return false;
    		}
    		else if (dropdown.value == '2') // bullet format
    		{
    			if (!ensureOneTextFieldIsFilled('A'+id+'tf77', 'A'+id+'tf78', 'A'+id+'tf79', 'A'+id+'tf80', 'A'+id+'tf81', 'A'+id+'tf82', 'A'+id+'tf83', 'A'+id+'tf84', 'A'+id+'tf85', 'A'+id+'tf86', 'A'+id+'tf87', 'A'+id+'tf88', 'A'+id+'tf89'))
    				return false;
    		}
    	}
     
    	// program modifications - annual goals
    	dropdown = getSelectForElement('A'+id+'op8');
    	if (dropdown)
    	{
    		if (dropdown.value == '1') // paragraph format
    		{
    			if (!ensureAllTextAreasAreFilled('A'+id+'P8'))
    				return false;
    		}
    		else if (dropdown.value == '2') // bullet format
    		{
    			if (!ensureOneTextFieldIsFilled('A'+id+'tf90', 'A'+id+'tf91', 'A'+id+'tf92', 'A'+id+'tf93', 'A'+id+'tf94', 'A'+id+'tf95', 'A'+id+'tf96', 'A'+id+'tf97', 'A'+id+'tf98', 'A'+id+'tf99', 'A'+id+'tf100', 'A'+id+'tf101', 'A'+id+'tf102'))
    				return false;
    		}
    	}
     
    	// school personnel
    	dropdown = getSelectForElement('A'+id+'op9');
    	if (dropdown)
    	{
    		if (dropdown.value == '1') // paragraph format
    		{
    			if (!ensureAllTextAreasAreFilled('A'+id+'P9'))
    				return false;
    		}
    		else if (dropdown.value == '2') // bullet format
    		{
    			if (!ensureOneTextFieldIsFilled('A'+id+'tf103', 'A'+id+'tf104', 'A'+id+'tf105', 'A'+id+'tf106', 'A'+id+'tf107', 'A'+id+'tf108', 'A'+id+'tf109', 'A'+id+'tf110', 'A'+id+'tf111', 'A'+id+'tf112', 'A'+id+'tf113', 'A'+id+'tf114', 'A'+id+'tf115'))
    				return false;
    		}
    	}
     
    	return true;
    }
     
    function updateCurriculumAreas ()
    {
    	if (isCheckboxOrRadioButtonSelected('R1b')) // 1 curriculum area
    	{
    		var listToShow = ['A1'];		
    		var listToHide = ['A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9'];
    		showElements(listToShow);
    		hideElements(listToHide);				
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1c')) // 2 curriculum areas
    	{
    		var listToShow = ['A1', 'A2'];		
    		var listToHide = ['A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9'];
    		showElements(listToShow);
    		hideElements(listToHide);				
    	}	
    	else if (isCheckboxOrRadioButtonSelected('R1d')) // 3 curriculum areas
    	{
    		var listToShow = ['A1', 'A2', 'A3'];		
    		var listToHide = ['A4', 'A5', 'A6', 'A7', 'A8', 'A9'];
    		showElements(listToShow);
    		hideElements(listToHide);				
    	}		
    	else if (isCheckboxOrRadioButtonSelected('R1e')) // 4 curriculum areas
    	{
    		var listToShow = ['A1', 'A2', 'A3', 'A4'];		
    		var listToHide = ['A5', 'A6', 'A7', 'A8', 'A9'];
    		showElements(listToShow);
    		hideElements(listToHide);				
    	}			
    	else if (isCheckboxOrRadioButtonSelected('R1f')) // 5 curriculum areas
    	{
    		var listToShow = ['A1', 'A2', 'A3', 'A4', 'A5'];		
    		var listToHide = ['A6', 'A7', 'A8', 'A9'];
    		showElements(listToShow);
    		hideElements(listToHide);				
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1g')) // 6 curriculum areas
    	{
    		var listToShow = ['A1', 'A2', 'A3', 'A4', 'A5', 'A6'];		
    		var listToHide = ['A7', 'A8', 'A9'];
    		showElements(listToShow);
    		hideElements(listToHide);				
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1h')) // 7 curriculum areas
    	{
    		var listToShow = ['A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7'];		
    		var listToHide = ['A8', 'A9'];
    		showElements(listToShow);
    		hideElements(listToHide);				
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1i')) // 8 curriculum areas
    	{
    		var listToShow = ['A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8'];
    		var listToHide = ['A9'];
    		showElements(listToShow);
    		hideElements(listToHide);
    	}
    	else if (isCheckboxOrRadioButtonSelected('R1j')) // 9 curriculum areas
    	{
    		var listToShow = ['A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9'];
    		showElements(listToShow);
    	}	
    	else // 0 curriculum areas (R1a) or no radio button selected
    	{
    		var listToHide = ['A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9'];
    		hideElements(listToHide);
    	}	
    }
     
    /*
     * Updates the section visibility
     */
    function updateSection(id1, id2)
    {
    	dropdown = getSelectForElement('A'+id1+'op'+id2);
    	if (dropdown)
    	{
    		if (dropdown.value == '1') // paragraph format
    		{
    			var listToShow = ['A'+id1+'P'+id2];
    			showElements(listToShow);
    			var listToHide = ['A'+id1+'B'+id2];
    			hideElements(listToHide);
    		}
    		else if (dropdown.value == '2') // bullet format
    		{
    			var listToShow = ['A'+id1+'B'+id2];
    			showElements(listToShow);
    			var listToHide = ['A'+id1+'P'+id2];
    			hideElements(listToHide);
    		}
    		else // no format, so hide fields
    		{
    			var listToHide = ['A'+id1+'P'+id2, 'A'+id1+'B'+id2];
    			hideElements(listToHide);
    		}
    	}
    }
     
    function updateVisibilityArd2()
    {
    	updateCurriculumAreas();
     
    	for (id1=1; id1<=9; id1++)
    	{
    		for (id2=1; id2<=9; id2++)
    		{
    			updateSection(id1, id2);
    		}
    	}
    }
    Last edited by Mittineague; Aug 18, 2011 at 21:29. Reason: reformatting bbcode tags


Tags for this Thread

Bookmarks

Posting Permissions

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