Hi
I played a little bit with rails+ajax, works fine...
but how do I reset the form?
I tried:
---
<%= form_remote_tag(:html => {:name =>
''form_update''},
:url => :url_new_item_with_ajax,
:update => ''container'',
:loading => "Toggle.display(''new-item'');
$(''new-item-desc'').innerHTML =
''Saving'';",
:complete => "$(''new-item-desc'').innerHTML =
''New item''; Field.clear(document.form_update.elements);")
%>
---
Field.clear should do it, but it doesn''t...
tia, bye
Wolfgang
I used:
<%= form_remote_tag(:html => {:name =>
''form_update''},
:url => :url_new_item_with_ajax,
:update => ''container'',
:loading =>
"document.getElementById(''somelement'').value=''''")%>
Regards,
Ben
Wolfgang Klinger wrote:
> Hi
>
> I played a little bit with rails+ajax, works fine...
> but how do I reset the form?
> I tried:
>---
><%= form_remote_tag(:html => {:name =>
''form_update''},
> :url => :url_new_item_with_ajax,
> :update => ''container'',
> :loading => "Toggle.display(''new-item'');
$(''new-item-desc'').innerHTML =
''Saving'';",
> :complete => "$(''new-item-desc'').innerHTML =
''New item''; Field.clear(document.form_update.elements);")
%>
>---
> Field.clear should do it, but it doesn''t...
>
>
> tia, bye
> Wolfgang
>
>
>_______________________________________________
>Rails mailing list
>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>
>
>
The W3C says the form elemement has a ''reset'' method, that
should
clear the whole form:
http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html#ID-40002357
document.getElementById(''myform'').reset()
Does that help?
Of course, I''m not sure if the browsers implement it...
On Fri, 25 Mar 2005 22:09:43 +1200, Ben Nolan
<ben-tH0n/LiDeu9BWQWeTLFoew@public.gmane.org>
wrote:> I used:
>
> <%= form_remote_tag(:html => {:name =>
''form_update''},
> :url => :url_new_item_with_ajax,
> :update => ''container'',
> :loading =>
"document.getElementById(''somelement'').value=''''")%>
>
> Regards,
> Ben
>
>
> Wolfgang Klinger wrote:
>
> > Hi
> >
> > I played a little bit with rails+ajax, works fine...
> > but how do I reset the form?
> > I tried:
> >---
> ><%= form_remote_tag(:html => {:name =>
''form_update''},
> > :url => :url_new_item_with_ajax,
> > :update => ''container'',
> > :loading => "Toggle.display(''new-item'');
$(''new-item-desc'').innerHTML =
''Saving'';",
> > :complete =>
"$(''new-item-desc'').innerHTML = ''New
item''; Field.clear(document.form_update.elements);") %>
> >---
> > Field.clear should do it, but it doesn''t...
> >
> >
> > tia, bye
> > Wolfgang
> >
> >
> >_______________________________________________
> >Rails mailing list
> >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> >http://lists.rubyonrails.org/mailman/listinfo/rails
> >
> >
> >
> >
> >
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
Ross M Karchner wrote:> The W3C says the form elemement has a ''reset'' method, that should > clear the whole form:The general behavior of ''reset'' is to return the form to the initial values (which may or not be empty). James
On Fri, 25 Mar 2005 12:24:31 -0500, Ross M Karchner <rosskarchner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The W3C says the form elemement has a ''reset'' method, that should > clear the whole form: > > http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html#ID-40002357 > > document.getElementById(''myform'').reset() >Not to be a pedant, but hat page you link to says nothing of the sort, at least for what I''m considering as the meaning of "clear". "reset Restores a form element''s default values. It performs the same action as a reset button."