If you're still around, feel free to IM me at outlookeic.

-- Yehuda

On 12/27/06, Phil Oye <[EMAIL PROTECTED]> wrote:

Ok, now I'm perplexed.

Originally, the submit button was in a fieldset. But even when I take
it out, and make it a direct child of the form itself, I get an error
that reads:

> this.parentNode.submit is not a function.
>

or


> form.submit is not a function.
>

When I click the text link, depending on which of the many methods
I'm using.

Here's a simplified form itself:

> <form action="" method="post">
>       <label>Comment</label>
>       <textarea name="comment" rows="12" cols="24"> </textarea>
>       <input id="submit" name="action[comment]" type="submit"
> value="Button text" />
> </form>
>

The action attribute is blank (I'm using the Symphony 21 CMS and this
is how the form works) so could that be causing the problem? Either
way, the form works fine without the javascript.

p.


On 28 Dec 2006, at 2:03 PM, John Resig wrote:

> Yeah, it does sound like that's the case - here's an alternate
> solution that does not assume that the form is the parent:
>
> $("<a href='' class='button'>ButtonText</a>")
>  .click(function() { $(this).parents("form")[0].submit(); return
> false; })
>  .insertAfter('input:submit');
>
> --John
>
> On 12/27/06, Yehuda Katz <[EMAIL PROTECTED]> wrote:
>> John's solution and mine assume that your link is a direct child
>> of the
>> form. Is it?
>>
>> -- Yehuda
>>
>>
>> On 12/27/06, Phil Oye < [EMAIL PROTECTED]> wrote:
>>> None of the proposed solutions are working for me. Now I'm wondering
>>> if it is a markup problem, or something.
>>>
>>> Bander's solution:
>>>> I'll bet it'll work with $(this).prev().click().
>>>
>>> Nothing happens.
>>> Presumably, because it attempts to go the original href ("#"), not
>>> the newly created onclick event?
>>>
>>>
>>> Mike's solution:
>>>> $(':submit').each(function() {
>>>>     var form = this.form;
>>>>     var b = $('<a href="#" class="button">Button Text</a>");
>>>>     $(this).after(b).hide();
>>>>     b.click(function() {
>>>>         form.submit();
>>>>         return false;
>>>>     });
>>>> });
>>>
>>> In FireBug, I get:
>>> form.submit is not a function.
>>> (Also, there was a typo in the close quote on line 3)
>>>
>>>
>>> Yehuda's solution:
>>>> $('[EMAIL PROTECTED]').after("<a href='#'
>>>> class='button'>ButtonText</a>").next().click(function()
>>>> { this.parentNode.submit(); })
>>>>
>>>> assuming the button and link are directly under the form.
>>>
>>> In FireBug, I get this error:
>>> this.parentNode.submit is not a function.
>>>
>>>
>>> John's solution:
>>>> $("<a href='' class='button'>ButtonText</a>")
>>>>   .click(function() { this.parentNode.submit(); return false; })
>>>>   .insertAfter('input:submit');
>>>
>>> I get the same error:
>>> this.parentNode.submit is not a function
>>> It then refreshes the page.
>>>
>>>
>>> Any ideas? Markup problem?
>>>
>>> Thanks,
>>> p.
>>>
>>>
>>> On 28 Dec 2006, at 11:40 AM, John Resig wrote:
>>>
>>>> Or, a similar, but different, way:
>>>>
>>>> $("<a href='' class='button'>ButtonText</a>")
>>>>   .click(function() { this.parentNode.submit(); return false; })
>>>>   .insertAfter('input:submit');
>>>>
>>>> --John
>>>>
>>>> On 12/27/06, Yehuda Katz <[EMAIL PROTECTED]> wrote:
>>>>> $('[EMAIL PROTECTED]').after("<a href='#'
>>>>>
>> class='button'>ButtonText</a>").next().click(function() {
>>>>> this.parentNode.submit(); })
>>>>>
>>>>> assuming the button and link are directly under the form.
>>>>>
>>>>> -- Yehuda
>>>>>
>>>>> On 12/27/06, Mike Alsup < [EMAIL PROTECTED]> wrote:
>>>>>>> Can you give me a pointer to fix this?
>>>>>>
>>>>>> $(':submit').each(function() {
>>>>>>     var form = this.form;
>>>>>>     var b = $('<a href="#" class="button">Button Text</a>");
>>>>>>     $(this).after(b).hide();
>>>>>>     b.click(function() {
>>>>>>         form.submit();
>>>>>>         return false;
>>>>>>     });
>>>>>> });
>>>>
>>>> _______________________________________________
>>>> jQuery mailing list
>>>> discuss@jquery.com
>>>> http://jquery.com/discuss/
>>>
>>> _______________________________________________
>>> jQuery mailing list
>>> discuss@jquery.com
>>> http://jquery.com/discuss/
>>>
>>
>>
>>
>> --
>> Yehuda Katz
>> Web Developer | Wycats Designs
>> (ph)  718.877.1325
>> _______________________________________________
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>>
>>
>>
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




--
Yehuda Katz
Web Developer | Wycats Designs
(ph)  718.877.1325
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to