Fork me on GitHub

Learning pnForm  Bottom

  • So I have decided to use pnForm for a new module I am creating and have looked at the documentation. However, I am stuck at square one. I have made a simple template, just to start playing with pnForm. Here is the code in the template.

    Code

    <!--[*  $Id: Micro551Feedback_user_main.htm 11499 2003-09-25 12:42:23Z jorg $  *]-->
    <!--[include file="Micro551Feedback_user_menu.htm"]-->
    <hr />

    <h3><!--[pnml name="MICRO5551FEEDBACK_INTROTITLE"]--></h3>
    <p><!--[pnml name="MICRO551FEEDBACK_INTRO"]--></p>
    <!--[pnform]-->
     
    <!--[/pnform]-->

    When I try to load this page I get a Smarty error. I am reproducing the essential part of the message below.

    Code

    An unknown error has occured. The following error message was returned by the system

    Smarty error: [in Micro551Feedback_user_main.htm line 7]: syntax error: unrecognized tag 'pnform' (Smarty_Compiler.class.php, line 599) (in file /Library/WebServer/Documents/microtextbook/includes/classes/Smarty/Smarty.class.php on line 1092)

    Back

    Additional technical information

    (array) 0:
    (string) file = /Library/WebServer/Documents/microtextbook/includes/classes/Smarty/Smarty.class.php
    (integer) line = 1092
    (string) function = trigger_error
    (array) args:
    (string) 0 = Smarty error: [in Micro551Feedback_user_main.htm line 7]: syntax error: unrecognized tag 'pnform' (Smarty_Compiler.class.php, line 599)
    (integer) 1 = 256


    Is there something I need to do to make pnForms work? The module is installed and working as far as I can tell. Any help appreciated.
  • Did you initialized pnForm as its shown in documentation?
    This should look like this:

    Code

    function demo_user_edit($args)
      {
        $render = FormUtil::newpnForm('demo');
        return $render->pnFormExecute('demo_user_edit.html', new demo_user_editHandler());
      }


    If you called template using just pnRender class - pnForms framework wont be loaded.

    --
    Polish Zikula Team
    Bianor Works - my Zikula works on CoZi
  • Ah, so that is it. I was just noodling around with the template. So if I want to use pnForms, instead of creating a pnRender object, I create the object using FormUtil::newpnForm();
    I think I have it, thanks.

    BTW, the documentation is a bit obtuse about this. There is no explicit warning about initialization.



    edited by: Paustian, Apr 14, 2009 - 03:38 PM
  • Paustian - be careful - you not only need to initialize pnForm framework, but also create and pass to pnForm handler class as shown in this tutorial:
    http://community.zikula.org/index.php?module=Wiki&tag=pnFormShortTutorial

    --
    Polish Zikula Team
    Bianor Works - my Zikula works on CoZi
  • I saw that in the tutorial page and have been able to get it working. pnForms again, saves a bunch of coding, nicely done. Another little glitch that others might run into has to deal with the Smarty template you create. If you want to add Smarty variables to a calls to a pnForm plugin, don't put it in quotes. Any hand coded stuff should be in quotes. For example.


    Code

    <td><!--[pnformtextinput id=$names[i].id text=$names[i].name maxLength="60"]--></td>




    edited by: Paustian, Apr 16, 2009 - 02:09 PM
  • 0 users

This list is based on users active over the last 60 minutes.