I'm in agreement. I've changed the name to 'act'.

I won't tell you how long it took to debug the problem as it's kind of
embarrassing! In case anyone else has issues like this, watch out for
naming your submit button 'submit'.

Adrian

On Oct 26, 7:14 pm, Wizzud <[EMAIL PROTECTED]> wrote:
> There is no way round it, and it's not down to jQuery.
> You're going to have to call your 'action'  field something else.
>
> On Oct 26, 12:10 pm, Adrian Lynch <[EMAIL PROTECTED]> wrote:
>
> > The long subject says it all!
>
> > If I have a hidden field named 'action', trying to change the form
> > action attribute fails in IE7.
>
> > If I change the hidden field to something other than action it works.
>
> > Can anyone think of a way around this? I would like to keep the hidden
> > field named 'action' if I can.
>
> > Is this a jquery bug, an IE7 bug, a quirk in JS or am I in the wrong
> > for naming a field 'action'?
>
> > Here's some sample code to see the problem:
>
> > <script type="text/javascript" src="/shared-scripts/
> > jquery-1.2.1.min.js"></script>
>
> > <form method="post" id="agentForm" action="nowhere.html">
> >         <input type="hidden" name="action" value="No value" />
> >         <input type="text" name="agentName" id="agentName" value="" />
> >         <input type="submit" name="saveAgent" id="saveAgent" value="Save" />
> > </form>
>
> > <button id="debug">Debug this fecking page!</button>
>
> > <script type="text/javascript">
>
> >         $(function() {
>
> >                 $("#saveAgent").click(function() {
>
> >                         // This should alert 'nowhere.html'
> >                         alert("action before: " + 
> > $("#agentForm").attr("action"));
>
> >                         // Change to 'somewhere.html'
> >                         $("#agentForm").attr("action", "somewhere.html"); 
> > // No worky in
> > IE7!
>
> >                         // This should alert 'somewhere.html' but doesn't 
> > in IE7
> >                         alert("action changed to: " + 
> > $("#agentForm").attr("action"));
>
> >                 });
>
> >         });
>
> > </script>

Reply via email to