I would like some static Form IDs

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
User avatar
FantomCircuit
Forum Members
Forum Members
Posts: 75
Joined: Fri Nov 10, 2006 1:34 am
Location: Gold Coast, Australia

I would like some static Form IDs

Post by FantomCircuit »

In a module I am developing, I need to attach some javascript via the form id. However, if other forms etc are added to the page, the form id changes.

eg// it goes from m6moduleform1 to m6moduleform2

This breaks all the javascript. Is there anyway to over-ride the form ids without breaking the form processing?
User avatar
FantomCircuit
Forum Members
Forum Members
Posts: 75
Joined: Fri Nov 10, 2006 1:34 am
Location: Gold Coast, Australia

Re: I would like some static Form IDs

Post by FantomCircuit »

Typical me, not acutally looking at the problem first *sigh*

it seems that the id of the form does not matter to cmsms. Is this correct? i manually set the form tag and id, and the form still seemed to work fine. Does anyone know if any functionality actually relies on the form id?

If not, why can't we directly control what the form id will be.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: I would like some static Form IDs

Post by calguy1000 »

The ID does matter.  Only parameters that match that ID are directed to the module.

If you want to use javascript on some of the module output, then I suggest you assign the form id to a smarty variable, and use that in your templates.

i.e:  $smarty->assign('formid',$id);
and then in your template, you can prefix all of the javascript stuff with {$formid}.  Of course it gets ugly with all the {literal} and {/literal} tags, but it can be done.

I'd suggest you do something like this:
{literal}
// some javascript code above including the script tag.
var formid = {/literal}{$formid}{/literal}
// some more javascript code

{/literal}
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.
User avatar
FantomCircuit
Forum Members
Forum Members
Posts: 75
Joined: Fri Nov 10, 2006 1:34 am
Location: Gold Coast, Australia

Re: I would like some static Form IDs

Post by FantomCircuit »

Oh, ok.

Hmm, good idea - thanks a lot for your help calguy!
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: I would like some static Form IDs

Post by calguy1000 »

Also, you can look at the FLVPlayer's summary and detail templates for example of integrating javascript into module output.
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.
Post Reply

Return to “Developers Discussion”