Jump to content

Hidden elements causing chk box problems


horseatingweeds

Recommended Posts

For crying out loud. I've been working on this script to populate check boxes after validation and if the user uses an EDIT button. It kept dropping the first chk element And I could not find out why.

 

I turned the hidden elements holding the the array returned from the chkbox array ass a string into text inputs so I could see what was going on. Well, it started working.

 

I changes them to hidden with a css class position absolute -800 -800.

 

Anyone else have this problem with hidden elements or know what this is all about?

Link to comment
https://forums.phpfreaks.com/topic/67497-hidden-elements-causing-chk-box-problems/
Share on other sites

I thought the question was more abstract Ken2k7. Does anyone know why a hidden element would wanker a script?

 

here is an example though, part of it anyway:

 

	$array = spliti("\|", $_POST['activities']);
foreach($array AS $activity)
{	
	switch ($activity)
	{
	case 'Doberman Puppies':
		GLOBAL $pup;
		$pup = "checked='checked'";
		break;
	case 'Adult Dobermans':
		GLOBAL $adult;
		$adult = "checked='checked'";
		break;
	case 'Trained Dobermans':
		GLOBAL $trained;
		$trained = "checked='checked'";
		break;
	case 'Stud Service':
		GLOBAL $stud;
		$stud = "checked='checked'";
		break;
	case 'Doberman Rescue':
		GLOBAL $rescue;
		$rescue = "checked='checked'";
		break;		
	}
}

 

There are 5 chk elements respective to each case. If the $_POST data comes from a hidden element every time it runs the first $activity goes away, and thus the first checked element shows unchecked.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.