Page 1 of 1

How to add a new property in class.content.inc.php ??

Posted: Mon Jul 03, 2006 2:14 pm
by Fido
Hello,

I'm trying to add a new property to content class.
His name is validator_id

in the form i've add a select list who display name of other users and their id in values.

i think i've well declare this new property in the class.

and i've added new field in the table.

anyway, when i post the form, i only can find the first value of the select list.

i don't see what to do more ?

If anyone can help me , please.

Re: How to add a new property in class.content.inc.php ??

Posted: Mon Jul 03, 2006 2:44 pm
by Elijah Lofgren
Fido wrote: in the form i've add a select list who display name of other users and their id in values.

i think i've well declare this new property in the class.

and i've added new field in the table.

anyway, when i post the form, i only can find the first value of the select list.
Maybe I'm misunderstanding you, but when a form is posted, only the selected value of a select list is sent by the browser. That would explain why you can only find the first value of the select list.

Re: How to add a new property in class.content.inc.php ??

Posted: Mon Jul 03, 2006 2:51 pm
by Fido
i select a different value in the select list before posting it.

here the code of the select :

Code: Select all

$userlist = UserOperations::LoadUsers();
					if ($userlist && count($userlist) > 0){
						echo '<select name="validator_id"';
						echo '><option value="?">Select the validator</option>';
						foreach ($userlist as $oneuser)
						{
							if($oneuser->active == 1 && $oneuser->id != $userid){
								echo '<option value="'.$oneuser->id.'"';
								if($oneuser->id == $validator_id){
									echo ' selected="selected"';
								}
								echo '>'.$oneuser->username.'</option>';
							}
						}
						echo '</select>';
					}
and anyway i always have the "?" value in the next page, even if i select "toto" with value 2.

For testing i've commented the redirect function after saving in the DB and i've put a phpinfo(32) that display $_REQUEST = ?

it's very strange

Re: How to add a new property in class.content.inc.php ??

Posted: Mon Jul 03, 2006 3:49 pm
by Fido
yes !

i've found !


I'm not understanding why, but it works.

In fact, i've added a line in "lib\contenttypes\Content.inc.php"

Code: Select all

array_push($ret, array(lang('validator').':',UserOperations::GenerateValidatorDropdown('validator_id', $userid, $this->mValidatorId )));

GenerateValidatorDropDown is a personal method that i've to user class

i guess that the POST data from form were parse again by or must be declare in that area ??