Hi AxKit people,
Im using PerForm version 1.7.
I am unable to populate single-select lists after field validation fails!

The population of single-select list works fine when the form is initially 
loaded. But if validation of either of the 
textfields on the form fails nothing is loaded into the html at all ! 
Exactly the same problem occurs when using either load_* callback or 
f:options child element (as per attached file) ... Please help!
Thanks in advance,
M Roper.
<xsp:page    xmlns:xsp="http://apache.org/xsp/core/v1";
             xmlns:f  ="http://axkit.org/NS/xsp/perform/v1";
>

  <xsp:logic>
    use strict;
    use EHum::Permissions;

    sub start_form_add_user {
        my($ctxt) = @_;
        my $r = $ctxt->{Apache};
        $ctxt->{Permissions} = new EHum::Permissions( $r->pnotes('EHUM_USERNAME'),
                                                      $r->pnotes('EHUM_PASSWORD') );
    }

    sub end_form_add_user {
        my $ctxt = shift;
        my $r = $ctxt->{Apache};
        $r->pnotes( EHUM_USERNAME => undef );
        $r->pnotes( EHUM_PASSWORD => undef );   
    }
    sub validate_username {
      my ($ctxt, $value) = @_;
      my $v = $ctxt->{Permissions}->invalid_username($value);
      if (defined($v)) {
        die $v;
      }
    }

    sub validate_password {
      my $ctxt = shift;
      my $pwd = $ctxt->{Form}{password};
      my $v = $ctxt->{Permissions}->invalid_password($pwd);
      if (defined($v)) {
        die $v;
      }
    }
    
    sub validate_groupnumber {
      my ($ctxt, $value) = @_;
      my $v = $ctxt->{Permissions}->invalid_group($value);
      if (defined($v)) {
        die $v;
      }
    }

    sub submit_save {
      my $ctxt = shift;
      $ctxt->{Permissions}->new_user($ctxt->{Form}{username}, 
                                     $ctxt->{Form}{password},
                                     $ctxt->{Form}{groupnumber});
    }

  </xsp:logic>

    <f:form name="add_user">
      Username: <f:textfield name="username" width="16" maxlength="16" />
      <br />
        Password: <f:password name="password" width="16" maxlength="16" />
        <br />
        Group: <f:single-select name="groupnumber">
          <f:options>
            <option><name>0</name><value>0</value></option>
            <option><name>1</name><value>1</value></option>
            <option><name>2</name><value>2</value></option>
          </f:options>
        </f:single-select>
        <br />
          <f:submit name="save" value="Save" />
          <f:cancel name="cancel" value="Cancel" goto="../../Menu.html" />
     </f:form>

</xsp:page>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to