Custom ID's in module forms and inputs for JavaScript

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
bbonora
Forum Members
Forum Members
Posts: 48
Joined: Mon Nov 06, 2006 6:10 am

Custom ID's in module forms and inputs for JavaScript

Post by bbonora »

Can custom id's be used for module forms and input fields? I know that the id of a form determines how the form is processed but if the form id matches the input id's does it matter what you use?

For example - normally you would create from elements like this:

Code: Select all

$this->CreateFormStart($id,'action',$returnid)
$this->CreateInputText($id,'blah')
Will the form still function correctly if you do something like this:

Code: Select all

$myid = 'customid';
$this->CreateFormStart($myid,'action',$returnid);
$this->CreateInputText($myid,'blah');
I'm in the process of building a module that requires a large amount of JavaScript. My goal is to dynamically generate my JavaScript using one PHP file. I would then include the file on the page using the "<__script__ />" tag like this:

Code: Select all

<__script__ src="http://localhost/index.php?mact=ContestManager,cntnt01,js,0&cntnt01showtemplate=false&cntnt01contest_id=1&cntnt01returnid=15" type="text/javascript"></__script>
The script "src" attribute will pass the "id" of the record (contest_id) to my php file. The php file will dynamically create my JavaScript based on the record id (contest_id).

Hope this makes sense. If anybody has an example of this technique currently being used in a module I would love to take a look.
Post Reply

Return to “Developers Discussion”