Page 1 of 1
How to retreive form name - (CreateFormStart generated)
Posted: Sat May 02, 2009 2:47 pm
by nervino
Hi All,
I'm using CreateFormStart to make a Form that has several checkboxes in it. In the template I put a javascript with a "select all" function and a HREF that fires this function.
Is there a way to grab the form's name generated by CreateFormStart()?
I've read the source of the parsed page and the form's name is "m1_moduleform_2".
If I put this name in the HREF it works:
Code: Select all
<a href="javascript:SetAllCheckBoxes('m1_moduleform_2', 'delete[]', true);">
but, is it posible to dynamically retreive the form's name?
Thank you
Re: How to retreive form name - (CreateFormStart generated)
Posted: Sun May 03, 2009 12:18 am
by Ted
There's no way to retrieve the form's name. But, you could pass a 'class="targetme"' into the $extra parameter. Then grab the first item from getElementFromClassName('targetme');, assuming you have a library (or grab one from google --
http://robertnyman.com/2008/05/27/the-u ... anno-2008/).
Not a perfect solution, but it works.
Re: How to retreive form name - (CreateFormStart generated)
Posted: Sun May 03, 2009 11:13 am
by nervino
Ted wrote:
Not a perfect solution, but it works.
That's important! Thank you Ted, I'll try it.
Re: How to retreive form name - (CreateFormStart generated)
Posted: Tue May 05, 2009 1:16 pm
by NaN
Whenever i use 'class="myForm"' or 'name="myForm"' in the extra parameter of CreateFormStart()
i get 'class=
"myForm
"'.
This is because the function
cms_module_CreateFormStart() in the lib/
modform.inc.php converts
everything that is passed to that function with
cms_htmlentities(); into HTML entities.
So what is the $extra param for if i cannot use quotes

Re: How to retreive form name - (CreateFormStart generated)
Posted: Thu May 21, 2009 9:12 pm
by NaN
NaN wrote:
So what is the $extra param for if i cannot use quotes
May i point someones interest in this question again?
I know i just need to disable one line in the modform.inc.php.
But is this really neccessary?
I mean who enters the $extra param when creating a form by using the cmsms module api function CreateFormStart()?
I believe there is no other man than a developer.
It is not possible to inject malicious code from outside with a classname oder a name attribute of form.
And no developer would use weird strings when calling this function.
So again, why is the $extra param converted with cms_htmlentities()

In my opinion there is no need to do this, isn't it?