You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Harald Becker <ha...@webscope.de> on 2003/07/17 20:11:45 UTC

Fill out formular fields with embperl

Is it possible, that Embperl automatically fills out the html formular
fields and takes the values from %fdat or %idat ?

The following example does not to work either with %idat or %fdat
I don't want to set the form values with value="[+ $fdat{info} +]"

test.htm:

[- $fdat{info} = "rewritten"; -]
<form action="test.htm">
<input type="text" name="info" value="testing">
</form>

What should happen is that input field info has the value "rewritten"
when printed to the browser.

Harald


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Fill out formular fields with embperl

Posted by Gerald Richter <ri...@ecos.de>.
><input type="text" name="info" value="testing">

If the value attribute is given Embperl doesn't nothing, without the value
attribute it will do what you want

Gerald

P.S. The solution Kee pointed out is only needed if you load the _html_
dynamicly for example from a database, but for what you want to do it seems
to be overkill


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Fill out formular fields with embperl

Posted by Gerald Richter <ri...@ecos.de>.
> >
> >Thank you, this works, but I've got a new problem :)
> >I need to declare the formular in a var and later I write it into the
> >document, and then Embperl does not fill out the formular... Is there a
> >solution, too ?
> 
> Instead of printing the form string, execute it.
> 

Aah, I should read all mails before answering...

In this case this is of course the correct solution.

Gerald



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


RE: Fill out formular fields with embperl

Posted by Kee Hinckley <na...@somewhere.com>.
At 8:52 PM +0200 7/17/03, Harald Becker wrote:
>  > I think it will do what you want if you remove the
>>  value="..." token from the input:
>>
>>  <input type="text" name="info">
>>
>>  If you need a default value, set it by placing a value in
>>  fdat above the
>>  input:
>>
>>  [- $fdat{info} = 'testing'; -]
>
>Thank you, this works, but I've got a new problem :)
>I need to declare the formular in a var and later I write it into the
>document, and then Embperl does not fill out the formular... Is there a
>solution, too ?

Instead of printing the form string, execute it.

[-
     Execute({
         input      => $db->{content},
         mtime      => $db->{dtm},
         inputfile  => $req_rec->uri(),
     });
-]

Something like that.  Note that the use of mtime and inputfile should 
cause Embperl to cache the results of the execute.

I'm not sure whether you'll have to pass fdat to the execute in this 
case, you'd have to try and see.  But fdat and fflds are options you 
can pass to Execute, so it will certainly work if you do.
-- 
Kee Hinckley
http://www.messagefire.com/          Anti-Spam Service for your POP Account
http://commons.somewhere.com/buzz/   Writings on Technology and Society

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


RE: Fill out formular fields with embperl

Posted by "Cameron B. Prince" <cp...@rideware.com>.
I am not exactly sure of the order of execution, but I know it doesn't work
like that... If you need interpolation on the form, you will have to do it
inside the same block that creates it.

As far as I know, there is no option to cause a page or block to be
reparsed.

Good luck,
Cameron

> -----Original Message-----
> From: Harald Becker [mailto:harald.becker@webscope.de]
> Sent: Thursday, July 17, 2003 1:52 PM
> To: embperl@perl.apache.org
> Subject: RE: Fill out formular fields with embperl
>
>
> > I think it will do what you want if you remove the
> > value="..." token from the input:
> >
> > <input type="text" name="info">
> >
> > If you need a default value, set it by placing a value in
> > fdat above the
> > input:
> >
> > [- $fdat{info} = 'testing'; -]
>
> Thank you, this works, but I've got a new problem :)
> I need to declare the formular in a var and later I write it into the
> document, and then Embperl does not fill out the formular...
> Is there a
> solution, too ?
>
> [-
> 	$fdat{info} = "testing";
>
> $_[0]->{formular} = '
> <form action="/test/form.htm">
> <input type=text name=info>
> </form>';
>
> -]
>
> [+ do{ local $escmode=0; $_[0]->{formular} } +]
>
> Harald
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


RE: Fill out formular fields with embperl

Posted by Harald Becker <ha...@webscope.de>.
> I think it will do what you want if you remove the 
> value="..." token from the input:
> 
> <input type="text" name="info">
> 
> If you need a default value, set it by placing a value in 
> fdat above the
> input:
> 
> [- $fdat{info} = 'testing'; -]

Thank you, this works, but I've got a new problem :)
I need to declare the formular in a var and later I write it into the
document, and then Embperl does not fill out the formular... Is there a
solution, too ?

[-
	$fdat{info} = "testing";

$_[0]->{formular} = '
<form action="/test/form.htm">
<input type=text name=info>
</form>';

-]

[+ do{ local $escmode=0; $_[0]->{formular} } +]

Harald


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


RE: Fill out formular fields with embperl

Posted by "Cameron B. Prince" <cp...@rideware.com>.
I think it will do what you want if you remove the value="..." token from
the input:

<input type="text" name="info">

If you need a default value, set it by placing a value in fdat above the
input:

[- $fdat{info} = 'testing'; -]

Cameron

> -----Original Message-----
> From: Harald Becker [mailto:harald.becker@webscope.de]
> Sent: Thursday, July 17, 2003 1:12 PM
> To: embperl@perl.apache.org
> Subject: Fill out formular fields with embperl
>
>
> Is it possible, that Embperl automatically fills out the html formular
> fields and takes the values from %fdat or %idat ?
>
> The following example does not to work either with %idat or %fdat
> I don't want to set the form values with value="[+ $fdat{info} +]"
>
> test.htm:
>
> [- $fdat{info} = "rewritten"; -]
> <form action="test.htm">
> <input type="text" name="info" value="testing">
> </form>
>
> What should happen is that input field info has the value "rewritten"
> when printed to the browser.
>
> Harald
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org