Where are Submitted Form values stored?
Where are Submitted Form values stored?
I am creating a form using CreateFormStart and CreateInputText and was wondering how CMSMS processes the submitted data.
I know that $_GET and $_POST are processed and stored in a variable somewhere but I cannot remember where. Can someone point me in the right direction?
I know that $_GET and $_POST are processed and stored in a variable somewhere but I cannot remember where. Can someone point me in the right direction?
Re: Where are Submitted Form values stored?
You pass a name variable to CreateInputText (the 2nd parameter). After the submit the submitted data is available in $params, so $params['name'].
Regards,
D
Regards,
D
Re: Where are Submitted Form values stored?
You also pass a action variable to CreateFormStart (also the 2nd parameter) to indicate which action should be done when the form is submitted, $params will be available in that action after the submit.
Regards,
D
Regards,
D
Re: Where are Submitted Form values stored?
I have used CreateInputBox and specified names for them, but when I submit the form and view $params, the InputText names have changed.
The first inputText has the correct name (test1) but then each input text has a different name (such as 0, 1, 2, eth).
Any ideas why it is doing this?
The first inputText has the correct name (test1) but then each input text has a different name (such as 0, 1, 2, eth).
Any ideas why it is doing this?
Re: Where are Submitted Form values stored?
To illustrate, the form is created and CMSMS creates 3 input boxes with names ord089345, ord149249, & ord149650.
When I submit some data in these boxes, $params displays this:
As you can see, the first input box has the correct name and value but the others do not.
Why?
When I submit some data in these boxes, $params displays this:
Code: Select all
Params
Array
(
[returnid] => 66
[089345] => A1
[0] => B1
[1] => C1
[Submit] => Add
[action] => default
)
Why?
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: Where are Submitted Form values stored?
if you have:
in your module
then in the action that receives the results, you should be able to do an:
I use code like this a thousand times.
maybe you could provide a snippet?
Code: Select all
$this->CreateInputText($id,'textfield');
then in the action that receives the results, you should be able to do an:
Code: Select all
echo $params['textfield'];
maybe you could provide a snippet?
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Where are Submitted Form values stored?
This is the line of code that I am using:
It is used in a loop that pulls product data from a table and uses $row['ProductNo'] as the name.
Code: Select all
{$this->CreateInputText($id,$row['ProductNo'], 0, 5, 5, 'style=\"width: 30px\"')}
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: Where are Submitted Form values stored?
You're not using that in a UserDefinedTag right? it won't work there.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Where are Submitted Form values stored?
No, this is located in the default action of my module.
Re: Where are Submitted Form values stored?
I don't see any problem (except for the style statement that shouldn't be escaped):
Output:
(m4 is the module ID assigned to the module instance)
After submit the entered values will be available as $params['test2'], $params['test4'] and $params['test7'].
Regards,
D
Code: Select all
$entries = array (
array('Id' => 1, 'ProductNo' => 'test2'),
array('Id' => 2, 'ProductNo' => 'test4'),
array('Id' => 3, 'ProductNo' => 'test7'),
);
foreach ($entries as $row)
{
echo $this->CreateInputText($id,$row['ProductNo'], 0, 5, 5, 'style=\"width: 30px\"');
}
Code: Select all
<input type="text" name="m4test2" id="m4test2" value="0" size="5" maxlength="5" style=\"width: 30px\" />
<input type="text" name="m4test4" id="m4test4" value="0" size="5" maxlength="5" style=\"width: 30px\" />
<input type="text" name="m4test7" id="m4test7" value="0" size="5" maxlength="5" style=\"width: 30px\" />
After submit the entered values will be available as $params['test2'], $params['test4'] and $params['test7'].
Regards,
D
Last edited by Anonymous on Wed Apr 25, 2007 9:51 am, edited 1 time in total.
Re: Where are Submitted Form values stored?
I tried your example and it worked as expected.
However I think I have tracked the cause of my issue.
Some of my Input boxes have names that begin with 1, 2, 3, etc.
For some reason CMSMS seems to have a problem with this.
If you would like to see this for yourself, create a module with this code then look at the submitted data in params.
Code:
HTML produced:
The result is:
However I think I have tracked the cause of my issue.
Some of my Input boxes have names that begin with 1, 2, 3, etc.
For some reason CMSMS seems to have a problem with this.
If you would like to see this for yourself, create a module with this code then look at the submitted data in params.
Code:
Code: Select all
echo $this->CreateFormStart( $id, $params['action'], $returnid, 'post', '', false, '' );
$entries = array (
array('Id' => 1, 'ProductNo' => '01234'),
array('Id' => 2, 'ProductNo' => '02345'),
array('Id' => 3, 'ProductNo' => '32345'),
array('Id' => 4, 'ProductNo' => '22356'),
array('Id' => 5, 'ProductNo' => '12356'),
);
foreach ($entries as $row)
{
echo $this->CreateInputText($id,$row['ProductNo'], 0, 5, 5, 'style="width: 30px"');
}
echo $this->CreateInputSubmit($id, 'Submit', 'Add', '', '', '');
echo $this->CreateFormEnd();
Code: Select all
<input type="text" name="ord01234" id="ord01234" value="0" size="5" maxlength="5" style="width: 30px" />
<input type="text" name="ord02345" id="ord02345" value="0" size="5" maxlength="5" style="width: 30px" />
<input type="text" name="ord32345" id="ord32345" value="0" size="5" maxlength="5" style="width: 30px" />
<input type="text" name="ord22356" id="ord22356" value="0" size="5" maxlength="5" style="width: 30px" />
<input type="text" name="ord12356" id="ord12356" value="0" size="5" maxlength="5" style="width: 30px" />
Code: Select all
ParamsArray
(
[returnid] => 66
[01234] => 1
[02345] => 2
[0] => 3
[1] => 4
[2] => 5
[Submit] => Add
[action] => default
)
Re: Where are Submitted Form values stored?
Could someone tell me which file contains the code that processes a form on submit and puts the values into $params?
I would like to take a look to see if I can work out why this is happening.
If this is a bug how do I go about submitting it?
I would like to take a look to see if I can work out why this is happening.
If this is a bug how do I go about submitting it?
Re: Where are Submitted Form values stored?
hi,
i dont think this is a specific cmsms problem.
i can remember working on a project a couple of years ago, and i had the same problem.
http://www.w3.org/TR/html4/types.html#type-cdata
i dont think this is a specific cmsms problem.
i can remember working on a project a couple of years ago, and i had the same problem.
http://www.w3.org/TR/html4/types.html#type-cdata
greets, rootkidID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").