[jQuery] Re: jQuery Form Plugin with a submit button outside of the form

2009-06-10 Thread johnHoysa

Yes valid markup rocks! I never thought of moving my form elements
around like I did so I thought posting my temporary solution might be
helpful to some. As I said temporary solution is the key phrase there.

I was able to get one of my buttons working as needed but am having
issues with my other button that has a showRequest and showResponse
function associated with it. Below is the working code for my button
when the button is placed inside the form element. What I want to do
is move my submit button outside the form and have the form submitted
via a click action. I tried moving my submit button outside the form
and it still works just fine and dreamweaver is saying my code is
valid. Also this seems to work in IE 7, FF, Safari and Chrome on my
PC. If I was not working locally I would be more then happy enough to
post my code for additional help/comments.

My working code is below.


$(document).ready(function() {
var options = {
beforeSubmit:  showRequest,
success:   showResponse
}

$('#addNewTasks').ajaxForm(options);
});// end document ready


// pre-submitcallback
function showRequest(formData, jqForm, options) {
//alert('About to submit');
var formElement = jqForm[0];
return true;
}

// post-submitcallback
function showResponse(responseText, statusText)  {
//alert('Submitted and will now show up once 
this alert is
closed.');
$.get('includes/tasks.cfm',{},function(data){
 $('#newTasks').html(data);
 $('ul:last').fadeIn("slow");
})
}


Any help with it would be great! Thanx in advance.

John


[jQuery] Re: jQuery Form Plugin with a submit button outside of the form

2009-06-09 Thread Mike Alsup

> You are able to span a form across a few divs. What I realized though
> is that there must be an equel number of divs between the Form tags to
> work properly

Yeah, valid markup always helps.  :-)

http://validator.w3.org/


[jQuery] Re: jQuery Form Plugin with a submit button outside of the form

2009-06-09 Thread johnHoysa

You are able to span a form across a few divs. What I realized though
is that there must be an equel number of divs between the Form tags to
work properly

for example this will work


 random content 
 my form elements to submit 
 content 
 content
submit button


This will not work for me, and this is what I was trying to do from
the get go.



 random content 
 my form elements to submit 
 content 
 content
submit button



Necmettin, thanx for the help!


[jQuery] Re: jQuery Form Plugin with a submit button outside of the form

2009-06-08 Thread johnHoysa


> Why not do
> 
> 
> [submit]
> 
> ? What differs if you do this?

If you move the form tag outside to an other div it just seems to stop
working unless in IE7.

I will try the button onclick like you suggested.

Thanx for the help.


[jQuery] Re: jQuery Form Plugin with a submit button outside of the form

2009-06-08 Thread Necmettin Begiter

On Mon, Jun 8, 2009 at 18:10, johnHoysa wrote:
>
> I have my form working great as long as my submit button is contained
> within the form tags. But the design calls for the submit button to be
> outside of the form. Any suggestions?

Don't get me wrong, but that is not logical at all. By design,
[submit] must be inside .

> 
> my form here
> 
>  
>  Submit button 

Why not do


[submit]

? What differs if you do this?

Try using basic Javascript, something like (fix and improve it of
course): . Of course
you'll need to replace d.f.submit() with your working function to
ajax-submit the form if that's what you wish.