#54 open

The dom extendor "$"

Reported by djokodonev | April 20th, 2009 @ 08:59 PM


I like to report maybe not a bug ... but i still call is a bug..

I had a form:

<a href="#" onclick="$('myId').submit(); return false;"> Save form button anywhere on the page </a>

<form id="myId" name"mYid" method="post">
<input name="test" id="test" value="i am a text field">
<input type="submit" name="submit" value="Save">

It will return an error in fireBug:

$("news_form").submit is not a function
onclick(click clientX=1197, clientY=189)UimwZw0j...Wjw%3D%3D (line 2)
[Break on this error] $("news_form").submit();

I guess, it is reading the field name - if the submit input, and when inspected to actually perform the submit request, it doesnt do that... it is not confusing.. it took me a whole hour to get this resolved..

Maybe i just need to learn more... But this was not obvious to me at all. :-)

BTW, i LOOOOOOOOOOOOOOVe prototype :-);

Comments and changes to this ticket

  • Tobie Langel

    Tobie Langel May 12th, 2009 @ 04:03 PM

    • State changed from “new” to “help_request”

    Sorry you're having trouble.

    Lighthouse is reserved for development purposes. Please direct assistance requests to the mailing list or IRC channel.

    Thanks for your understanding.

  • djokodonev

    djokodonev May 21st, 2009 @ 12:29 AM

    Well it is an dev issue, i fugured it out, i am not looking for support Tobie, I am saying if you name an - - in a form with lets say id (form_id), and try to use the dom extendor - e.g $('form_id').submit(), to submit the form onclick event, It gets confused by reading the command as the field value..

    Try it yourself... If you say it is not a bug it should be this way then OK.
    This command - $('form_id').submit(), should submit the form. It should not read the value of the input field, it is very confusing dude.

    It is a bug as far as i am concerned...

    But any ways.. If i have teh time i will fix it and send you the fix.


  • Tobie Langel

    Tobie Langel May 21st, 2009 @ 10:46 AM

    I understand your issue better now. This is a known DOM problem, and there isn't much a framework can do about it. You should avoid to use such identifiers in naming your form fields.

  • djokodonev

    djokodonev May 21st, 2009 @ 10:48 AM

    well, i guess it should be listed at least as warning.. it sure is confusing to new users of the Prototype framework.

    It was unknown to me :-).

    Thanks for the reply though


  • Tobie Langel

    Tobie Langel May 21st, 2009 @ 06:57 PM

    • Assigned user set to “T.J. Crowder”
    • State changed from “help_request” to “doc”
    • Milestone cleared.

    It is a JavaScript / DOM issue. Not a PRototype issue. But you're right it should probably be marked in the docs.

  • djokodonev

    djokodonev May 21st, 2009 @ 08:06 PM

    That would be very usefull indeed :-).

    I didn't realize it was a dom issue, i didn't ment to incult you at all :-). Sorry if i did that in any way, prototype is just great!!!!!!!! :-).

    I only wish i was so smart :-).

    anyways, it would definitely be a great thing if this issue is listed as warning in the documents.. I usually use the same name - input name, id and even php variable etc.. so I named the submit input - submit...

    That was a real agony... tell the truth i felt really stupid :-) and very re leaved when i figured it out :-). A small victory over ignorance :-).

    Thank you for the reply again

    Best Regards

    George Donev

  • Tobie Langel
  • T.J. Crowder

    T.J. Crowder November 16th, 2009 @ 04:50 PM

    • Assigned user cleared.

    [responsible:none bulk edit command]

  • Tobie Langel

    Tobie Langel November 29th, 2009 @ 07:18 PM

    • Milestone cleared.
    • Assigned user set to “Samuel Lebeau”
  • Tobie Langel

    Tobie Langel November 29th, 2009 @ 08:11 PM

    • State changed from “doc” to “open”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins

People watching this ticket

Referenced by