OpenToken Shortcuts
See also: OpenToken Parsing
Return to Introduction  Previous page  Next page

If your modules admin-configurable fields already support OpenTokens, then why not add the Token Shortcut Selection boxes to your admin screens?!?! Here's how...

Just stick these functions anywhere in your module:

<MvFUNCTION NAME = "InsertToken_Macro" PARAMETERS = "" STANDARDOUTPUTLEVEL = "">   
  <MvIF EXPR = "{ g.Merchant_Version LT 4.14 }">   
    <MvDO FILE = "{g.Module_Root $ 'modules/ui/oui.mv'}" NAME = "l.ok" VALUE = "{ OUI_Open_Store() }">   
    <MvIF EXPR = "{ l.ok }">   
      <MvIF EXPR = "{ g.OUIX_Module_Version GE 4.66 }">   
        <MvDO FILE = "{g.Module_Root $ 'modules/ui/oui.mv'}" NAME = "l.trash" VALUE = "{ InsertToken_Macro() }">   
      </MvIF>   
    </MvIF>   
  <MvELSE>   
    <MvDO FILE = "{g.Module_Root $ 'modules/ui/oui.mvc'}" NAME = "l.ok" VALUE = "{ OUI_Open_Store() }">   
    <MvIF EXPR = "{ l.ok }">   
      <MvIF EXPR = "{ g.OUIX_Module_Version GE 4.83 }">   
        <MvDO FILE = "{g.Module_Root $ 'modules/ui/oui.mvc'}" NAME = "l.trash" VALUE = "{ InsertToken_Macro() }">   
      </MvIF>   
    </MvIF>   
  </MvIF>    
 
  <MvFUNCRETURN VALUE = "">   
</MvFUNCTION>    
 
<MvFUNCTION NAME = "TokenSel_Macro" PARAMETERS = "field" STANDARDOUTPUTLEVEL = "">   
  <MvIF EXPR = "{ g.Merchant_Version LT 4.14 }">   
    <MvIF EXPR = "{ g.OUIX_Module_Version GE 4.66 }">   
      <MvDO FILE = "{g.Module_Root $ 'modules/ui/oui.mv'}" NAME = "l.trash" VALUE = "{ TokenSel_Macro(l.field) }">   
    </MvIF>   
  <MvELSE>   
    <MvIF EXPR = "{ g.OUIX_Module_Version GE 4.83 }">   
      <MvDO FILE = "{g.Module_Root $ 'modules/ui/oui.mvc'}" NAME = "l.trash" VALUE = "{ TokenSel_Macro(l.field) }">   
    </MvIF>   
  </MvIF>    
 
  <MvFUNCRETURN VALUE = "">   
</MvFUNCTION>     
 
Then, add this code at the top of your "tab" (or screen):

<MvASSIGN NAME = "l.trash" VALUE = "{ InsertToken_Macro() }">     
 
That's the setup. Now, all you have to do is right above each input "field" (or text area), just add this line:

<MvASSIGN NAME = "l.trash" VALUE = "{ TokenSel_Macro('fieldname') }">     
 
Just replace fieldname with the name of the input field. That's all there is to it.


 


Send feedback on this documentation.
© 2004 - 2000 Darren Ehlers & OpenUI Developer Consortium