Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] How to dynamicaly create modules in a page

Expand Messages
  • Todd Kloots
    bambou713705 - Sounds like you are passing the same id (your modName parameter) to the Module constructor each time. Each new Module you create will require
    Message 1 of 3 , Apr 30, 2007
    • 0 Attachment
      "bambou713705" -

      Sounds like you are passing the same id (your modName parameter) to the
      Module constructor each time. Each new Module you create will require a
      unique id.

      - Todd

      bambou713705 wrote:
      > Hi there,
      >
      > I'am using, YUI in my web site, in particular the module container.
      > I've got a form page where users put some informations about "plates",
      > they can add every plates that they want.
      >
      > A part of informations of one plate are in a YUI module. So I need to
      > generate the module each time users want to add a plate.
      >
      > I've made a little function close of the module exemple that ca be
      > found on the YUI module page. This function activate a module (which
      > have been added by an ajax request). This is the function :
      >
      > function moduleActivation(modName, showName, hideName) {
      > YAHOO.rui.module = new YAHOO.widget.Module(modName);
      > YAHOO.rui.module.render();
      > YAHOO.rui.module.hide();
      > document.getElementById(hideName).style.visibility="hidden";
      > YAHOO.util.Event.addListener(showName, "click",
      > YAHOO.rui.module.show, YAHOO.rui.module, true);
      > YAHOO.util.Event.addListener(hideName, "click",
      > YAHOO.rui.module.hide, YAHOO.rui.module, true);
      > }
      >
      > modName is the name of the div representing the module
      > showName is the name of the show button
      > hideName is the name of the hide button
      >
      > The problem is that every time the function is called, it always use
      > the same object YAHOO.rui.module and so, only the last module function
      > correctly when I push on the hide or show button
      >
      > How can I fix that problem?
      >
      > Thanks
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
    • bambou713705
      yes thanks, I fix by adding a var keyword in front of my variable ... require a
      Message 2 of 3 , May 3, 2007
      • 0 Attachment
        yes thanks, I fix by adding a "var" keyword in front of my variable



        --- In ydn-javascript@yahoogroups.com, Todd Kloots <kloots@...> wrote:
        >
        > "bambou713705" -
        >
        > Sounds like you are passing the same id (your modName parameter) to the
        > Module constructor each time. Each new Module you create will
        require a
        > unique id.
        >
        > - Todd
        >
        > bambou713705 wrote:
        > > Hi there,
        > >
        > > I'am using, YUI in my web site, in particular the module container.
        > > I've got a form page where users put some informations about "plates",
        > > they can add every plates that they want.
        > >
        > > A part of informations of one plate are in a YUI module. So I need to
        > > generate the module each time users want to add a plate.
        > >
        > > I've made a little function close of the module exemple that ca be
        > > found on the YUI module page. This function activate a module (which
        > > have been added by an ajax request). This is the function :
        > >
        > > function moduleActivation(modName, showName, hideName) {
        > > YAHOO.rui.module = new YAHOO.widget.Module(modName);
        > > YAHOO.rui.module.render();
        > > YAHOO.rui.module.hide();
        > > document.getElementById(hideName).style.visibility="hidden";
        > > YAHOO.util.Event.addListener(showName, "click",
        > > YAHOO.rui.module.show, YAHOO.rui.module, true);
        > > YAHOO.util.Event.addListener(hideName, "click",
        > > YAHOO.rui.module.hide, YAHOO.rui.module, true);
        > > }
        > >
        > > modName is the name of the div representing the module
        > > showName is the name of the show button
        > > hideName is the name of the hide button
        > >
        > > The problem is that every time the function is called, it always use
        > > the same object YAHOO.rui.module and so, only the last module function
        > > correctly when I push on the hide or show button
        > >
        > > How can I fix that problem?
        > >
        > > Thanks
        > >
        > >
        > >
        > >
        > > Yahoo! Groups Links
        > >
        > >
        > >
        > >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.