[html-formfu] Multiple Submits

Moritz Onken onken at houseofdesign.de
Wed Aug 15 10:03:46 GMT 2007


Hi,

I'm still a bit afraid of that Unicode- stuff. Will it always work if I
use Unicode in my submit value? There is so much decoding and encoding
between server and client and in the server itself.

I'll try the value_loc approach, thanks!

Moritz

Carl Franks schrieb:
> On 14/08/07, Moritz Onken <onken at houseofdesign.de> wrote:
>> I started today using FormFu and I just like it! Carl, you did a
>> very good Job!
> 
> Thanks - I'm glad it's useful.
> 
>> But I ran into one problem. I want to use multiple submit buttons.
>> The common way is, to set a value on each and check that value
>> later to determine which has been clicked. That's fine asa long as
>> your page is in only one language.
> 
> Could you not do something like:
> 
> if ( $form->param( 'submit_1' ), eq $form->loc( 'submit_1' ) ) { #
> submit_1 pressed } elsif ( $form->param( 'submit_2' ), eq $form->loc(
> 'submit_2' ) ) { # submit_2 pressed }
> 
> That's assuming the form is created something like this:
> 
> --- elements: - type: submit name: submit_1 value_loc: submit_1 -
> type: submit name: submit_2 value_loc: submit_2
> 
> The only potential problem I think think of with this approach is if:
>  * you're storing the user's language choice using a session or
> cookie * after viewing the page containing the form, but before
> submitting the form... * ...the user uses a 2nd browser window to
> change their language choice You could prevent this by also storing
> the language choice in a hidden field, and then doing
> $form->languages([ $form->param('lang') ]) before doing the 'eq'
> checks.
> 
>> I thought of a hidden field whose value is being changed on
>> submitting (by JS). If there is no better way I will write an
>> element for that and publish it.
> 
> I'd like to make sure that nothing in the core relies on JS for 
> functionality - so make sure you pick an appropriate namespace if you
>  write something like that.
> 
> For example, I've created a couple of elements in the 
> HTML::FormFu::Element::Dojo::* namespace which use the dojo
> javascript library (although even these degrade gracefully and are
> usable without JS). See
> http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-Dojo/
> 
> Cheers, Carl
> 
> _______________________________________________ HTML-FormFu mailing
> list HTML-FormFu at lists.scsys.co.uk 
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu



More information about the HTML-FormFu mailing list