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

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Fido
Forum Members
Forum Members
Posts: 104
Joined: Fri Mar 31, 2006 3:10 pm

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

Post 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.
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am
Location: Deatsville, AL

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

Post 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.
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
Fido
Forum Members
Forum Members
Posts: 104
Joined: Fri Mar 31, 2006 3:10 pm

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

Post 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
Fido
Forum Members
Forum Members
Posts: 104
Joined: Fri Mar 31, 2006 3:10 pm

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

Post 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 ??
Post Reply

Return to “Developers Discussion”