0

In another thread I found that a good way to show and hide parts of a form based on previous entries would be as follows:

function showhidefield (method) {
			var hideablearea = document.getElementById("hideablearea");
			var hideablearea2 = document.getElementById("hideablearea2");
			var hideablearea3 = document.getElementById("hideablearea3");

			switch (method) {
			case "1":
				hideablearea.style.display = 'block';
				hideablearea2.style.display = 'none';
				hideablearea3.style.display = 'none';
				break;
			case "2":
				hideablearea.style.display = "none";
				hideablearea2.style.display = "block";
				hideablearea3.style.display = "block";
				break;
			case "3":
				hideablearea.style.display = "block";
				hideablearea2.style.display = "block";
				hideablearea3.style.display = "block";
				break;
			default:
				hideablearea.style.display = "none";
				hideablearea2.style.display = "none";	
				hideablearea3.style.display = "none";
			}
		}

I know how to use javascript to validate that the forms are infact filled but how do I make it so that it doesn't scan the hidden forms. The only way I could think of would be a huge bunch of if statements.

Is there any other way to do this?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Chokladkakan
0

Well, I don't know how your validation loop works, but you could add something like

if(WhatEverYourFOrmVariableIsNames.type == hidden){ don't validate }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.