Mailing List Archive

Select Selected
I thought I had gotten smart. I am working on a project with a none
coder. They know HTML fairly well so I had come up with a plan that
would keep them from having to look at as much Embperl code as
possible.

Here is my idea:
(db_row_hash is a function from an extrnal module that returns a
fetchrow_hashref of the data from the database )
[.- $prospect_data = db_row_hash("SELECT * FROM Prospect WHERE
Prospect_ID = $udat{Prospect_ID}") -]

[$ foreach $key (sort keys %$prospect_data) $]
[- $value = $prospect_data->{$key}; -]
[- $url .= qq|$key\=$prospect_data->{$key}\&|; -]

[$ endforeach $]
[+ $url +]
[- $http_headers_out{'Location'} = "newvisitor_reg2.html?$url"; -]

This works great and passes the returned values to the page, however the

selects are not selected. The input fields are filled in however.

Do the selects have to be dynamic (while/foreach) to be selected?
I am I expecting too much from the Embperl parser?

Embperl VERSION: 1.2.0

On Windows 98 with Apache 1.3.9 and mod_perl 1.21

Aaron Johnson
Re: Select Selected [ In reply to ]
Not sure what you mean when you say selects are not selected.

cliff rayman
genwax.com

Aaron Johnson wrote:

> I thought I had gotten smart. I am working on a project with a none
> coder. They know HTML fairly well so I had come up with a plan that
> would keep them from having to look at as much Embperl code as
> possible.
>
> Here is my idea:
> (db_row_hash is a function from an extrnal module that returns a
> fetchrow_hashref of the data from the database )
> [.- $prospect_data = db_row_hash("SELECT * FROM Prospect WHERE
> Prospect_ID = $udat{Prospect_ID}") -]
>
> [$ foreach $key (sort keys %$prospect_data) $]
> [- $value = $prospect_data->{$key}; -]
> [- $url .= qq|$key\=$prospect_data->{$key}\&|; -]
>
> [$ endforeach $]
> [+ $url +]
> [- $http_headers_out{'Location'} = "newvisitor_reg2.html?$url"; -]
>
> This works great and passes the returned values to the page, however the
>
> selects are not selected. The input fields are filled in however.
>
> Do the selects have to be dynamic (while/foreach) to be selected?
> I am I expecting too much from the Embperl parser?
>
> Embperl VERSION: 1.2.0
>
> On Windows 98 with Apache 1.3.9 and mod_perl 1.21
>
> Aaron Johnson
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
Re: Select Selected [ In reply to ]
Cliff,

My URL contains ...&my_select=1&...

But when the page is rendered the my_select option is not selected.

option I suppose is a better choice of words here vs. select since select is
the form element type and the option is what actually gets selected.

That is:
<SELECT NAME="my_select">
<OPTION VALUE="0">None
<OPTION VALUE="1">One
</SELECT>

And from the perldocs:

OPTION
Embperl checks if there is a value from the form data for a specific
option in a menu. If so, this option will be pre-selected.

Example:

<FORM METHOD="POST"> <P>Select Tag</P>

If you request this document with list.htm?SEL1=x
you can specify that the element which has a value
of x is initially selected

<P><SELECT NAME="SEL1">
<OPTION VALUE="[+ $v[$row] +]">
[+ $k[$row] +]
</OPTION>
</SELECT></P>
</FORM>

The values I am trying to select contain no spaces which I thought may be the
culprut to begin with.

Hope that explains it a little better.

Aaron Johnson

Cliff Rayman wrote:

> Not sure what you mean when you say selects are not selected.
>
> cliff rayman
> genwax.com
>
> Aaron Johnson wrote:
>
> > I thought I had gotten smart. I am working on a project with a none
> > coder. They know HTML fairly well so I had come up with a plan that
> > would keep them from having to look at as much Embperl code as
> > possible.
> >
> > Here is my idea:
> > (db_row_hash is a function from an extrnal module that returns a
> > fetchrow_hashref of the data from the database )
> > [.- $prospect_data = db_row_hash("SELECT * FROM Prospect WHERE
> > Prospect_ID = $udat{Prospect_ID}") -]
> >
> > [$ foreach $key (sort keys %$prospect_data) $]
> > [- $value = $prospect_data->{$key}; -]
> > [- $url .= qq|$key\=$prospect_data->{$key}\&|; -]
> >
> > [$ endforeach $]
> > [+ $url +]
> > [- $http_headers_out{'Location'} = "newvisitor_reg2.html?$url"; -]
> >
> > This works great and passes the returned values to the page, however the
> >
> > selects are not selected. The input fields are filled in however.
> >
> > Do the selects have to be dynamic (while/foreach) to be selected?
> > I am I expecting too much from the Embperl parser?
> >
> > Embperl VERSION: 1.2.0
> >
> > On Windows 98 with Apache 1.3.9 and mod_perl 1.21
> >
> > Aaron Johnson
> >
> > ---------------------------------------------------------------------
> > 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: Select Selected [ In reply to ]
>
> My URL contains ...&my_select=1&...
>

Could enable the the dbgForm and dbgInput debugging Flag and take a look at
the embperl logfile. You should see something like

FORM: my_select = 1

at the start of the request, do you?

> But when the page is rendered the my_select option is not selected.
>
> option I suppose is a better choice of words here vs. select
> since select is
> the form element type and the option is what actually gets selected.
>
> That is:
> <SELECT NAME="my_select">
> <OPTION VALUE="0">None
> <OPTION VALUE="1">One
> </SELECT>
>

This should really select the "One" automaticly

What happen if you request the page manualy (i.e. without redirect)?

Gerald
Re: Select Selected [ In reply to ]
Gerald,

Success. The problem was I had turned off the table scan since the orginal
page contained some table errors and I was just trying to the scripting part
done without effecting their code. In reading and output (error_log) I noticed
that only the INPUT tags were being processed. Then I remembered that the docs
said that SELECT and lists were handled by the same section that handles the
tables. That is when I realized I had [- $optDisableTableScan = 1 -] at the
top of the page and it was turning off the SELECT processing.

All better now.

Thanks.

Aaron Johnson

Gerald Richter wrote:

> >
> > My URL contains ...&my_select=1&...
> >
>
> Could enable the the dbgForm and dbgInput debugging Flag and take a look at
> the embperl logfile. You should see something like
>
> FORM: my_select = 1
>
> at the start of the request, do you?
>
> > But when the page is rendered the my_select option is not selected.
> >
> > option I suppose is a better choice of words here vs. select
> > since select is
> > the form element type and the option is what actually gets selected.
> >
> > That is:
> > <SELECT NAME="my_select">
> > <OPTION VALUE="0">None
> > <OPTION VALUE="1">One
> > </SELECT>
> >
>
> This should really select the "One" automaticly
>
> What happen if you request the page manualy (i.e. without redirect)?
>
> Gerald
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org