form attribute action and input with same name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jan Gregor

    form attribute action and input with same name

    Hello

    I want to change attribute action in form. Problem is that in that form
    is also input with name action. Unfortunately renaming of that input is
    worst case because many servlets depend on it.

    This works in konqueror but not in IE and Mozilla:

    newurl= document.forms[i].getAttribute(' action');
    newurl= newurl.replace( 'all/', prefix);
    document.forms[i].action= newurl;

    Do you have any idea how to modify attribute action in this case ?


    Jan


  • McKirahan

    #2
    Re: form attribute action and input with same name

    "Jan Gregor" <gregor.jan@NOS PAMquick.cz> wrote in message
    news:cj11f4$223 d$1@ns.felk.cvu t.cz...[color=blue]
    > Hello
    >
    > I want to change attribute action in form. Problem is that in that form
    > is also input with name action. Unfortunately renaming of that input is
    > worst case because many servlets depend on it.
    >
    > This works in konqueror but not in IE and Mozilla:
    >
    > newurl= document.forms[i].getAttribute(' action');
    > newurl= newurl.replace( 'all/', prefix);
    > document.forms[i].action= newurl;
    >
    > Do you have any idea how to modify attribute action in this case ?
    >
    >
    > Jan[/color]


    What does your form look like?

    Is it basically like the following?

    <form action="nextpag e.htm" method="post">
    <input type="text" name="action">
    </form>

    And is your problem that you want to change "nextpage.h tm" to something
    else?


    Comment

    • Jan Gregor

      #3
      Re: form attribute action and input with same name

      On 2004-09-24, McKirahan <News@McKirahan .com> wrote:[color=blue]
      >
      > What does your form look like?
      >
      > Is it basically like the following?
      >
      ><form action="nextpag e.htm" method="post">
      ><input type="text" name="action">
      ></form>
      >
      > And is your problem that you want to change "nextpage.h tm" to something
      > else?
      >[/color]

      Yes.

      There's an example:

      <form action="all/OrderCostKeyLis t" method="get" name="frmOCKL">
      <input type="Hidden" name="action" value="step2">

      I want to transform all/OrderCostKeyLis t to client/OrderCostKeyLis t.
      There's little progress. In getAttribute replace of 'action' to 'Action' lead
      to success in mozilla(firefox ). Of course I see that this is a bit
      magic. On other side browsers should allow access to attributes other
      way or inputs with same name as attributes should be banned.

      Jan

      Comment

      • Michael Winter

        #4
        Re: form attribute action and input with same name

        On Fri, 24 Sep 2004 11:46:44 +0000 (UTC), Jan Gregor
        <gregor.jan@NOS PAMquick.cz> wrote:
        [color=blue]
        > I want to change attribute action in form. Problem is that in that form
        > is also input with name action.[/color]

        [snip]
        [color=blue]
        > Do you have any idea how to modify attribute action in this case ?[/color]

        I don't think there is any way. Certainly not one that would be reliable.
        Either rename the control, or perhaps have all/OrderCostKeyLis t redirect
        to client/OrderCostKeyLis t server-side.

        You should always try to ensure that form controls do not conflict with
        member names. Due to the provision of shortcut control accessors -
        expressions like

        document.formNa me.controlName

        - a form control with override the value of an existing property. Names
        like submit, reset, action, and method (this is not an exhaustive list)
        should be avoided.

        Good luck,
        Mike

        --
        Michael Winter
        Replace ".invalid" with ".uk" to reply by e-mail.

        Comment

        • VK

          #5
          Re: form attribute action and input with same name

          var act = myForm.getAttri buteNode('actio n');
          act.value = newURL;


          Approved in DOM 1, tested OK under my IE 6.0


          P.S. My Lord, I didn't realize what a mess they did since 4th versions...
          Good to know...
          form.action= (property) and form.action.val ue= (form element) should have
          and used to have totally different assignments.
          This is that you get by "simplifyin g" a normal language into an Orwell style
          "newtalk".



          Comment

          • Jan Gregor

            #6
            Re: form attribute action and input with same name

            In article <41553d37$0$248 53$9b622d9e@new s.freenet.de>, VK wrote:[color=blue]
            > var act = myForm.getAttri buteNode('actio n');
            > act.value = newURL;
            >
            >
            > Approved in DOM 1, tested OK under my IE 6.0
            >[/color]

            It works under konqueror and firefox, but not in IE5. Opera6 doesn't
            support changing of action at all.


            Jan

            Comment

            Working...