Hi Andrew

Thanks for the response.

I ended up (at least for the time being) doing an
undef($fdat{select_field}) which worked but it seems a bit messy.  I
was hoping there was some way to disable this processing with
optDisableSomething.

Anyway, I achieved what I needed to.  Many thanks

Michael

On Jan 21, 2008 3:32 PM, Andrew O'Brien <[EMAIL PROTECTED]> wrote:
>
> Hi Michael,
>
> > Can someone please clarify how I prevent 'selected' being
> > automatically added to selects?  Here's my embperl file:
>
> > What happens is that once you submit the form, 'selected' gets
> > automatically added to the relevant option tag.
> >
> > How can I prevent this, and set it (or not set it) myself instead??
>
> What I usually do is structure my simple input processing in a number of
> stages. Things are different in places of course but I find this is a
> common pattern:
>
> 1. if we are not here as a result of a form submission (check a submit
> value or something) then seed %fdat with any initial values you want in
> your form. ie get from database or set to defaults from the user profile
> or whatever.
>
> 2. if we *are* here as a result of a form submit then process the form
> submit as normal. Here, override values in %fdat if you need to as part
> of your processing (eg deleting or explicitly setting
> $fdat{select_field} to the value you want preselected.
>
> (1 and 2 can be reversed depending on the type of processing you're
> doing)
>
> 3. Now go on with the rest of the page and let Embperl do its thing.
>
> This way, there is rarely any code in the body of the page that isn't
> just conditional output processing. All the code is readable near the
> top and coherently grouped. I just trust Embperl to do the right thing
> with escaping values and processing %fdat.
>
> I find it an extremely rare thing that I need to set form values in the
> HTML explicitly with this simple approach.
>
> Cheers,
>
> Andrew
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to