[html-formfu] refresh of the form

Carl Franks fireartist at gmail.com
Fri Mar 12 12:13:16 GMT 2010


On 12 March 2010 11:34, rahed <raherh at gmail.com> wrote:
> Carl Franks <fireartist at gmail.com> writes:
>
>> On 10 March 2010 10:07, rahed <raherh at gmail.com> wrote:
>> I don't know why the behaviour is changing when you switch to FormFu -
>> are there any noticable differences in the outputted HTML?
>
> Well, the FormBuilder uses a hidden form field _submitted which is
> processed in the source.
> I had to distinguish in my application code three conditions -
> submitted, refresh and others.

I've tested this out with a new Catalyst app, with meta-refresh set to
10 seconds, with the following form:

elements:
  - name: foo
    label: Foo
  - type: Submit
    name: Submit

The Controller is empty, so any submitted form will just be
redisplayed, including any values the user entered.
When I first load the page, the form is empty.
When I type a value into the "foo" field and submit the form, the page
is redisplayed with the same form, containing the "foo" value I
entered.
After 10 seconds, the page auto-refreshes - and at this point I can
see in the Catalyst Debug output, that no values are sent to the
server (tested in both firefox + IE).

This particular part of the process has nothing to do with FormFu - it
seems to be normal browser behaviour to not resubmit a form during a
meta-refresh.
So I think the next step needed is to figure out why it did work with
FormBuilder. JavaScript maybe?
Check the generated source code, and look at the live Debug output
during the refreshes.

[% IF c.session.refresh %]
Where does this value come from? (I don't know if it's relevant)

>> I believe your
>>     form.get_field('submit').value = 'Submit'
>> should be
>>     form.get_field('submit').default = 'Submit'
>
> Shouldn't they be aliases?

It might not have anything to do with your particular issue.
It's not an alias for all fields, but I can't remember off-hand for
which fields - it's maybe just radio/checkbox-type fields.

I don't know that this'll have any affect - if you don't set a value
for Submit buttons, the browser will automatically set a value such as
"Submit Form".
I noticed that IE only sends a Submit value to the server if the
button is clicked - it doesn't send a name/value pair for the Submit
button if you submit the form by pressing Enter in a text field.
- so I'd not recommend using a Submit button value as any kind of indicator.

Carl



More information about the HTML-FormFu mailing list