Re: [PHPLIB] Oohforms - marshal_dispatch() From: Bob Strouper (bobw123 <email protected>)
Date: 01/11/00

Well, could marshal_dispach() ( and the oohforms script in general) be more
bewildering? ;-)

Ulf, after looking at your recomendation I stuck some
echos in the function:

function marshal_dispatch($m,$func) {
$vname = $this->name;
global $$vname;

$rr = $this->$func($$vname);
$ss = $this->$func($this->value);
$rg = $m;

echo "METHOD IS: " . $rg . " VNAME IS: " . $vname . " VALUE: " . $$vname .
"<br><br>";
echo "thisfunc(vname): " . $rr . "<br><br>";
echo "thisfunc(thisvalue): " . $ss . "<br><br>";
echo "<hr>";
return $this->$func($$vname);
}

I found that apon a submission of a form text element "name" with
GOOD data ( one that passes validate ) $ss still has the error string in it:

//----------

METHOD IS: VNAME IS: name VALUE: thename

thisfunc(vname):

thisfunc(thisvalue): ERROR: Please enter the Name. Valid characters are:
letters, numbers,
underscorers, single quote, and spaces only

//--------

I didn't go ahead and implement your changes fully, so I didn't see if it
would
actually break it.

Another thing I found is that the $method ($m) never has a value.... very
strange.

Bob

>Hi,
>
>anyone there that can explain me marshal_dispatch() in
>oohform.inc?
>I know marshal_dispatch() was written to start the elements
>validation. Usually it calls self_validate() method of each
>element. I just wonder about $$vname. Who needs it?
>
>function marshal_dispatch( $m, $func ) {
> $vname = $this->name; # get the element name
> global $$vname; # defines a new global variable -
>but whatfor?
> return $this->$func($$vname) # call self_validate()
>}
>
>This code cannot handle element names looking like arrays such as
>"customer[surname]". I've no idea why. My marshal_dispatch() does
>a good job job for me. How about a change?
>
>function marshal_dispatch( $m, $func ) {
> return $this->$func($this->value));
>}

______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com?sr=mc.mk.mcm.tag001

-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.