[jQuery] Re: Way to designate links as form submitters?

2008-05-05 Thread Rick Faircloth

Thanks for the feedback, Real...

The solution I worked up below, targeting .get(0) (first form
on the page), works fine because there is only one form.

But your solution would probably work as well for one form,
but have the added benefit of working for multiple forms.

I'll file you solution away for future use!  :o)

Thanks,

Rick

> -Original Message-
> From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of real
> Sent: Monday, May 05, 2008 1:38 PM
> To: jQuery (English)
> Subject: [jQuery] Re: Way to designate links as form submitters?
> 
> 
> If you're trying to replicate the functionality of a submit button,
> then the link would only submit the form it's contained in. A regular
> submit button wouldn't submit any form (unless I'm mistaken) if it's
> not within the  tags anyway. So why not something like this?
> 
> $(document).ready(function(){
> $('a.formlink').click(function(){
> $(this).parents('form').submit();
> return false;
> });
> });
> 
> This way you can have multiple forms on the page if needed.
> 
> On May 2, 12:48 pm, "Rick Faircloth" <[EMAIL PROTECTED]> wrote:
> > Well... the original plan was to use the pagination links
> > on the page to submit the form fields.   That way a user
> > could change the search options and just continue clicking the
> > pagination links instead of "submitting" the new options.
> >
> > However, I believe this might be confusing, so I created a
> > "Click here" link after making option choices to make it clear
> > what the user is supposed to do.
> >
> > And yes, Karl, there's only one form on the page...
> >
> > This solution (it's different than the example submit link I
> > tossed out earlier) is working fine:
> >
> > $(document).ready(function() {
> > $('.submitLink').click(function() {
> > $('form').get(0).submit();
> > return false;
> > });
> > });
> >
> > With a text link like this:
> >
> > Uncheck the boxes above to remove those property types from the listings 
> > and click
> > here.
> >
> > So, up to this point, everything's working well.
> >
> > You can see it in action 
> > at:http://c21ar.wsm-dev.com/cfm/browse-properties.cfm
> >
> > Let me know if you have any trouble with it if you decide to check it out.
> >
> > Thanks for all the help!
> >
> > Rick
> >
> > > -Original Message-
> > > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of hj
> > > Sent: Friday, May 02, 2008 11:45 AM
> > > To: jQuery (English)
> > > Subject: [jQuery] Re: Way to designate links as form submitters?
> >
> > > > Anyway to do that?
> >
> > > > Have certain links, say with an id of "link",
> > > > to be programmed to submit a form when clicked?
> >
> > > Why not mark up the links as buttons, or input type=submit elements,
> > > and then
> > > just use CSS to style them appropriately?
> >
> > > --
> >
> > > hj




[jQuery] Re: Way to designate links as form submitters?

2008-05-05 Thread real

If you're trying to replicate the functionality of a submit button,
then the link would only submit the form it's contained in. A regular
submit button wouldn't submit any form (unless I'm mistaken) if it's
not within the  tags anyway. So why not something like this?

$(document).ready(function(){
$('a.formlink').click(function(){
$(this).parents('form').submit();
return false;
});
});

This way you can have multiple forms on the page if needed.

On May 2, 12:48 pm, "Rick Faircloth" <[EMAIL PROTECTED]> wrote:
> Well... the original plan was to use the pagination links
> on the page to submit the form fields.   That way a user
> could change the search options and just continue clicking the
> pagination links instead of "submitting" the new options.
>
> However, I believe this might be confusing, so I created a
> "Click here" link after making option choices to make it clear
> what the user is supposed to do.
>
> And yes, Karl, there's only one form on the page...
>
> This solution (it's different than the example submit link I
> tossed out earlier) is working fine:
>
> $(document).ready(function() {
> $('.submitLink').click(function() {
> $('form').get(0).submit();
> return false;
> });
> });
>
> With a text link like this:
>
> Uncheck the boxes above to remove those property types from the listings 
> and click
> here.
>
> So, up to this point, everything's working well.
>
> You can see it in action at:http://c21ar.wsm-dev.com/cfm/browse-properties.cfm
>
> Let me know if you have any trouble with it if you decide to check it out.
>
> Thanks for all the help!
>
> Rick
>
> > -Original Message-
> > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of hj
> > Sent: Friday, May 02, 2008 11:45 AM
> > To: jQuery (English)
> > Subject: [jQuery] Re: Way to designate links as form submitters?
>
> > > Anyway to do that?
>
> > > Have certain links, say with an id of "link",
> > > to be programmed to submit a form when clicked?
>
> > Why not mark up the links as buttons, or input type=submit elements,
> > and then
> > just use CSS to style them appropriately?
>
> > --
>
> > hj


[jQuery] Re: Way to designate links as form submitters?

2008-05-02 Thread Rick Faircloth

Well... the original plan was to use the pagination links
on the page to submit the form fields.   That way a user
could change the search options and just continue clicking the
pagination links instead of "submitting" the new options.

However, I believe this might be confusing, so I created a
"Click here" link after making option choices to make it clear
what the user is supposed to do.

And yes, Karl, there's only one form on the page...

This solution (it's different than the example submit link I
tossed out earlier) is working fine:

$(document).ready(function() {
$('.submitLink').click(function() {
$('form').get(0).submit();
return false;
});
});

With a text link like this:

Uncheck the boxes above to remove those property types from the listings and 
click
here.

So, up to this point, everything's working well.

You can see it in action at:
http://c21ar.wsm-dev.com/cfm/browse-properties.cfm

Let me know if you have any trouble with it if you decide to check it out.

Thanks for all the help!

Rick





> -Original Message-
> From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of hj
> Sent: Friday, May 02, 2008 11:45 AM
> To: jQuery (English)
> Subject: [jQuery] Re: Way to designate links as form submitters?
> 
> 
> > Anyway to do that?
> >
> > Have certain links, say with an id of "link",
> > to be programmed to submit a form when clicked?
> 
> Why not mark up the links as buttons, or input type=submit elements,
> and then
> just use CSS to style them appropriately?
> 
> --
> 
> hj




[jQuery] Re: Way to designate links as form submitters?

2008-05-02 Thread hj

> Anyway to do that?
>
> Have certain links, say with an id of "link",
> to be programmed to submit a form when clicked?

Why not mark up the links as buttons, or input type=submit elements,
and then
just use CSS to style them appropriately?

--

hj


[jQuery] Re: Way to designate links as form submitters?

2008-05-01 Thread Karl Swedberg


Hi Rick,

You aren't using multiple forms, are you? If you are, you're going to  
run into problems with multiple elements having the same id -- with  
the way this appears to be set up now.


Anyway, I think this could be a little simpler. Assuming a single  
form, maybe something like this:


$(document).ready(function(event) {
  event.preventDefault();
  $('a.formlink').click(function() {
$('#supporttype').val(this.id);
$('#supportform').submit();
  });
});

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On May 1, 2008, at 12:55 PM, Carl Von Stetten wrote:



Rick,

Try this (untested):

$(document).ready(function() {
   $.each(".formlink"), function() {
  $(this).click(function() {
 $("#supporttype").val($(this).attr("id");
 $("#supportform").submit();
  });
   });
});

action="yourscriptname.cgi">



Paid Support or
Free Support

HTH,
Carl

Rick Faircloth wrote:

As a follow-up to my question, I found this method
that utilizes regular JS, but I'd like to be able to
cause any link with a certain id to act as a "Submit Link".

Here's the code I found to create a text submit link:








Paid Support or
Free Support

Thanks for any help in changing this to jQuery!

Rick





-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery- 
[EMAIL PROTECTED] On Behalf Of Rick Faircloth

Sent: Thursday, May 01, 2008 12:08 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Way to designate links as form submitters?


Anyway to do that?

Have certain links, say with an id of "link",
to be programmed to submit a form when clicked?

Rick












[jQuery] Re: Way to designate links as form submitters?

2008-05-01 Thread Carl Von Stetten

Rick,

Try this (untested):

$(document).ready(function() {
$.each(".formlink"), function() {
   $(this).click(function() {
  $("#supporttype").val($(this).attr("id");
  $("#supportform").submit();
   });
});
});




Paid Support or
Free Support

HTH,
Carl

Rick Faircloth wrote:
> As a follow-up to my question, I found this method
> that utilizes regular JS, but I'd like to be able to
> cause any link with a certain id to act as a "Submit Link".
>
> Here's the code I found to create a text submit link:
>
> 
> 
> 
>
> 
>
> 
> Paid Support or
> Free Support
>
> Thanks for any help in changing this to jQuery!
>
> Rick
>
>
>
>   
>> -Original Message-
>> From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick 
>> Faircloth
>> Sent: Thursday, May 01, 2008 12:08 PM
>> To: jquery-en@googlegroups.com
>> Subject: [jQuery] Way to designate links as form submitters?
>>
>>
>> Anyway to do that?
>>
>> Have certain links, say with an id of "link",
>> to be programmed to submit a form when clicked?
>>
>> Rick
>>
>> 
>
>
>
>
>   


[jQuery] Re: Way to designate links as form submitters?

2008-05-01 Thread the_woodsman

Hey,

THis shouldn't be tricky, as long as you cna easily find which form
you want to submit!

Are there multiple forms on the page to choose between?

Something like this *should* submit the first form on the page
(untested) ...

$('.submitLink')
.click(

function()
{
$('form').get(0).submit();
return false;
}

);

On May 1, 5:32 pm, "Rick Faircloth" <[EMAIL PROTECTED]> wrote:
> As a follow-up to my question, I found this method
> that utilizes regular JS, but I'd like to be able to
> cause any link with a certain id to act as a "Submit Link".
>
> Here's the code I found to create a text submit link:
>
> 
> 
> 
>
> 
>
> 
> Paid Support or
> Free Support
>
> Thanks for any help in changing this to jQuery!
>
> Rick
>
> > -Original Message-
> > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
> > Rick Faircloth
> > Sent: Thursday, May 01, 2008 12:08 PM
> > To: jquery-en@googlegroups.com
> > Subject: [jQuery] Way to designate links as form submitters?
>
> > Anyway to do that?
>
> > Have certain links, say with an id of "link",
> > to be programmed to submit a form when clicked?
>
> > Rick


[jQuery] Re: Way to designate links as form submitters?

2008-05-01 Thread Rick Faircloth

As a follow-up to my question, I found this method
that utilizes regular JS, but I'd like to be able to
cause any link with a certain id to act as a "Submit Link".

Here's the code I found to create a text submit link:








Paid Support or
Free Support

Thanks for any help in changing this to jQuery!

Rick



> -Original Message-
> From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick 
> Faircloth
> Sent: Thursday, May 01, 2008 12:08 PM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Way to designate links as form submitters?
> 
> 
> Anyway to do that?
> 
> Have certain links, say with an id of "link",
> to be programmed to submit a form when clicked?
> 
> Rick
>