Menu

Server-side validation

Help
Alin Vaida
2003-12-15
2003-12-17
  • Alin Vaida

    Alin Vaida - 2003-12-15

    Unfortunately, I can't get it to work. I studied the example presented on the website, with no luck so far. The client-side validation works great, but if I disable javascript, nothing happens. The form is submitted and no error message appears.

    Here is the template I use:

    ....
    <fs:form name="testf" action="" method="post">
        <fs:input name="text1" type="text" />
        <fs:validate field="text1" check="empty" message="You have to type a text in Text field" />
        <fs:ifErrormessage field="text1">
                <fs:errormessage field="text1" />
        </fs:ifErrormessage>
    </fs:form>
    ....
    =========================

    And the script:

    ....
    $tpl = &new Smarty_formsess();
    $tpl->fs_root = ".......";
    $tpl->enableFormsess();

    $fs = &new formsess("testf");

    if (is_array($_POST))
    {
        $fs->performCheck();
    }

    $tpl->display("testform.tpl");
    .....
    =========================

    Maybe i got it wrong...
    Any help would be appreciated

    Alin

     
    • frobnicate foo

      frobnicate foo - 2003-12-17

      Bonjour,

      you should make sure that you start your session on both pages. Do you really have got this action="" ?

      hth, janosch.

       
    • Alin Vaida

      Alin Vaida - 2003-12-17

      Yes, the session is started, but still no luck.

      action="" sends the data back to the originating page.

      Thanks,
      Alin

       
    • Alin Vaida

      Alin Vaida - 2003-12-17

      Indeed, starting the session made it work. I didn't realize it the first time.

      Thanks a lot janosch,
      Alin

       

Log in to post a comment.