Form problem - i can only get data from $_POST and not from $params

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
welworx
Forum Members
Forum Members
Posts: 12
Joined: Sat Mar 21, 2009 2:04 am

Form problem - i can only get data from $_POST and not from $params

Post by welworx »

Hello everybody!

I'm trying do develop a modul and have the problem, that i can't get the data out of my form. (I'm Using cmsms 1.5.3)

this is my default.action.php file:

Code: Select all

<?php
debug_display($params);
debug_display($_POST);
echo $params['description'];
echo $this->CreateFormStart($id, 'default', $returnid);
echo $this->CreateInputText($id,'description',$desc);
echo $this->CreateInputSubmit($id, 'submit', $this->Lang('submit'));
echo $this->CreateFormEnd();
?>
If i submit the form i can see the submitted data in the $_POST Array, but not in the $params (In $params i can ony find the returnid and the action)

Does anybody can help me with this?
vilkis

Re: Form problem - i can only get data from $_POST and not from $params

Post by vilkis »

Hi,
change the line

Code: Select all

echo $this->CreateFormStart($id, 'default', $returnid);
to

Code: Select all

echo $this->CreateFrontendFormStart($id,$returnid);
You can use CreateFormStart, also. Do it in such a manner

Code: Select all

echo $this->CreateFormStart($id, 'default', $returnid,'post','',true);

Vilkis
welworx
Forum Members
Forum Members
Posts: 12
Joined: Sat Mar 21, 2009 2:04 am

Re: Form problem - i can only get data from $_POST and not from $params

Post by welworx »

Hi!

thank you very much for you reply. I have changed the line, but the result is still the same  :'(

Debug: (0.087701) - (10204296)

Number of elements: 3
Array
(
    [module] => test
    [returnid] => 15
    [action] => default
)

Debug: (0.087749) - (10204520)

Number of elements: 5
Array
(
    [mact] => test,m4,default,1
    [m4returnid] => 15
    [page] => 15
    [m4description] => asdf
    [m4submit] => Save
)

Do you have any idea what is going wrong?
welworx
Forum Members
Forum Members
Posts: 12
Joined: Sat Mar 21, 2009 2:04 am

Re: Form problem - i can only get data from $_POST and not from $params

Post by welworx »

When i insert the {debug} command, I get the following error message at the end of the page:

{$gCms} 
Fatal error: Allowed memory size of 262144000 bytes exhausted (tried to allocate 924459 bytes) in /var/www/cmsms_v1.5.3/lib/smarty/plugins/modifier.debug_print_var.php on line 47

Is this normal in a clean new setup?

Here is my complete output:

Code: Select all

assigned template variables
{$SCRIPT_NAME} 	"/cmsms_v1.5.3/index.php"
{$app_name} 	"CMS"
{$author_label} 	"Erstellt von:"
{$category_label} 	"Kategorie:"
{$class} 	"noprint"
{$content_id} 	"15"
{$content_obj} 	Content Object (35)
->additionalContentBlocks = Array (0)
->addtContentBlocksLoaded = false
->mId = "15"
->mName = "Home"
->mType = "content"
->mOwner = "1"
->mProperties = ContentProperties Object (4)
   ->mPropertyNames = Array (10)
    0 => "content_en"
    1 => "image"
    2 => "thumbnail"
    3 => "searchable"
    4 => "disable_wysiwyg"
    5 => "target"
    6 => "pagedata"
    7 => "extra1"
    8 => "extra2"
    9 => "extra3"
   ->mPropertyTypes = Array (10)
    content_en => "string"
    target => "string"
    pagedata => "string"
    extra1 => "string"
    extra2 => "string"
    extra3 => "string"
    image => "string"
    thumbnail => "string"
    searchable => "string"
    disable_wysiwyg => "string"
   ->mPropertyValues = Array (10)
    content_en => "{cms_module module='FrontEndUserSearc..."
    target => ""
    pagedata => ""
    extra1 => ""
    extra2 => ""
    extra3 => ""
    image => "-1"
    thumbnail => ""
    searchable => "1"
    disable_wysiwyg => "0"
   ->mAllowedPropertyNames = Array (10)
    0 => "content_en"
    1 => "target"
    2 => "pagedata"
    3 => "extra1"
    4 => "extra2"
    5 => "extra3"
    6 => "searchable"
    7 => "image"
    8 => "thumbnail"
    9 => "disable_wysiwyg"
->mPropertiesLoaded = true
->mParentId = "-1"
->mOldParentId = "-1"
->mTemplateId = "17"
->mItemOrder = "1"
->mOldItemOrder = "1"
->mMetadata = ""
->mTitleAttribute = "Home Page, shortcut key=1"
->mAccessKey = "1"
->mTabIndex = ""
->mHierarchy = "00001"
->mIdHierarchy = "15"
->mHierarchyPath = "home"
->mMenuText = "Home"
->mActive = true
->mAlias = "home"
->mOldAlias = "home"
->mCachable = true
->mPreview = true
->mShowInMenu = true
->mDefaultContent = true
->mMarkup = "html"
->mLastModifiedBy = "1"
->mCreationDate = "2006-07-25 21:22:31"
->mModifiedDate = "2009-03-22 09:49:54"
->mAdditionalEditors = null
->mReadyForEdit = false
->mChildCount = 0
{$count} 	4
{$encoding} 	"utf-8"
{$endform} 	"</form><i>\n</i>"
{$entry} 	stdClass Object (20)
->author_id = "1"
->author = "admin"
->authorname = "Admin User"
->id = "1"
->title = "News Module Installed"
->content = "The news module was installed. Excit..."
->summary = null
->postdate = "2009-03-22 09:47:46"
->startdate = null
->enddate = null
->category = "General"
->fieldsbyname = Array (0)
->fields = Array (0)
->file_location = "http://server/cmsms_v1.5.3/uploads/ne..."
->link = "http://server/cmsms_v1.5.3/index.php?..."
->titlelink = "<a href="http://server/cmsms_v1.5.3/i..."
->morelink = "<a href="http://server/cmsms_v1.5.3/i..."
->moreurl = "http://server/cmsms_v1.5.3/index.php?..."
->printlink = "<a href="http://server/cmsms_v1.5.3/i..."
->printurl = "http://server/cmsms_v1.5.3/index.php?..."
{$firstpage} 	"«"
{$friendly_position} 	"1"
{$gCms} 	
Fatal error: Allowed memory size of 262144000 bytes exhausted (tried to allocate 924459 bytes) in /var/www/cmsms_v1.5.3/lib/smarty/plugins/modifier.debug_print_var.php on line 47
welworx
Forum Members
Forum Members
Posts: 12
Joined: Sat Mar 21, 2009 2:04 am

Re: Form problem - i can only get data from $_POST and not from $params

Post by welworx »

I found the problem :-)

I had in the test.module.php the following line:

Code: Select all

function SetParameters()
    {
        $this->RestrictUnknownParams();
    }
That line came from the skeleton plugin, but i have not copied the

Code: Select all

$this->SetParameterType('description',CLEAN_STRING);
line ;-)

After changing to

Code: Select all

function SetParameters()
    {
        $this->RestrictUnknownParams();
$this->SetParameterType('description',CLEAN_STRING);
    }
everything was alright!

:-)
Post Reply

Return to “Developers Discussion”