Re: [jQuery] Form not submitting

2007-01-17 Thread Mike Alsup
 Ahh, that explains it.  There isn't a submit button on the form.   I have an
 image that triggers the validation.

 So... is there a way to get the form to submit without that.  Perhaps I
 should have a hidden submit button?

You don't *have* to have a submit button on the form, but you really
should.  What if javascript is disabled?  You still want the form to
work, right?

You can use your image as a submit element if you like:

input type=image src=myImage.gif /

 Unfortunately that doesn't work either. In firebug I get:
 $(#login)[0].submit is not a function

Can you post your code?

Mike

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


Re: [jQuery] Form not submitting

2007-01-17 Thread Dan G. Switzer, II
Dave,

 $(#login)[0].submit();

Unfortunately that doesn't work either. In firebug I get:
$(#login)[0].submit is not a function

I get the same error with
document.login.submit();

The document.login.submit() would only work if you have a form tag w/the
name attribute of login. 

What does document.getElementById(login).submit() do?

-Dan


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


Re: [jQuery] Form not submitting

2007-01-17 Thread Mungbeans



dave.methvin wrote:
 
 
 Do you have a form with the id of login? If not, use a different
 selector
 to get it. The key is to call the submit method on the underlying DOM
 object
 of the form.
 
 $(selector-to-your-form)[0].submit()
 
 

Yes it is there.  Absolutely, definitely.
-- 
View this message in context: 
http://www.nabble.com/Form-not-submitting-tf3025179.html#a8419229
Sent from the JQuery mailing list archive at Nabble.com.


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


Re: [jQuery] Form not submitting

2007-01-17 Thread Mungbeans



malsup wrote:
 
 
 You don't *have* to have a submit button on the form, but you really
 should.  What if javascript is disabled?  You still want the form to
 work, right?
 
 You can use your image as a submit element if you like:
 
 input type=image src=myImage.gif /
 

Actually my code starts off with an image submit button (and the form works
well without javasript), but javascript swaps it for a standard image
because the transparency for the image doesn't work when it is used in an
input field.   Here is the code (I renamed the form from login to
frmLogin):

The javascript:

function submitLoginForm() {
 //validation is working so I know that the load form function worked
  if ( ($(#username).val()== ) || ($(#passwd).val()== )) {
alert (Please complete the username and password fields.);
return false;
  }
  //THIS IS THE PART CAUSING TROUBLE
  $('#frmLogin')[0].submit();

}

function loadLoginForm() {
$(#submit-container).empty().append( \images/sign-in.png\ );
$(#submit).keydown( function() { 
 //actually I'd like this event only to be linked to the enter key - haven't
worked that one out yet
submitLoginForm(); 
}).click(function(){
submitLoginForm(); 
});
}

Teensy bit of CSS:
.img_button {
cursor: pointer;
}

And finally the form:
form action=index.php method=post name=frmLogin 
id=frmLogin

fieldset

legendnbsp;Sign innbsp;/legend

p* Required fields/p

label for=username class=followon User name:/label
br /
input name=username id=username 
type=text size=20 tabindex=1 /
br /
label for=passwd class=followon Password: */label
br /
input name=passwd id=passwd 
type=password class=followon size=20  tabindex=2 /
br /
label for=rememberRemember me/label
input type=checkbox name=remember name=remember
class=checkbox value=yes  tabindex=3 / 
br /br /

div id=submit-container
input type=image name=submit id=submit
value=Sign in src=images/sign-in.png tabindex=4 / 
/div

/fieldset
input type=hidden name=option id=option value=login /
/form
-- 
View this message in context: 
http://www.nabble.com/Form-not-submitting-tf3025179.html#a8419439
Sent from the JQuery mailing list archive at Nabble.com.


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


Re: [jQuery] Form not submitting

2007-01-17 Thread Olaf Bosch
Mungbeans schrieb:

try this:

function submitLoginForm() {
  //validation is working so I know that the load form function worked
  // when this do, then is submitted
   if ( ($(#username).val()== ) || ($(#passwd).val()== )) {
 alert (Please complete the username and password fields.);   
 return false;
   } else {

   //THIS IS THE PART CAUSING TROUBLE
   // what is to do, #username and #passwd are valid
   // what make we now with this??? ;)

}

-- 
Viele Grüße, Olaf

---
[EMAIL PROTECTED]
http://olaf-bosch.de
www.akitafreund.de
---

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


Re: [jQuery] Form not submitting

2007-01-17 Thread Mungbeans



Olaf wrote:
 
 
 function submitLoginForm() {
   //validation is working so I know that the load form function worked
   // when this do, then is submitted
if ( ($(#username).val()== ) || ($(#passwd).val()== )) {
  alert (Please complete the username and password fields.); 
  return false;
} else {
 
//THIS IS THE PART CAUSING TROUBLE
// what is to do, #username and #passwd are valid
// what make we now with this??? ;)
   
 }
 
 

Thanks, Olaf.  Since last posting I reworked the javascript (pretty much as
you said):

function submitLoginForm() {
if  ($(#username).val()== ) {
alert (Please complete the username fields.); 
return false;
} else if  ($(#passwd).val()== ) {
alert (Please complete the password field.);  
return false;
} else {
$('#frmLogin')[0].submit();
}
}

function loadLoginForm() {

$(#js).val(1);
$(#submit).keydown( function() { 
submitLoginForm(); 
return false;
}).click(function(){
submitLoginForm();
return false; 
});
}

I tested the functions without the image replacement and discovered that the
whole thing works well when the javascript is called from a submit button,
rather than the image used in the replacement.   So the submit function
can't be called from an image like this:

lt;img src=images/sign-in.png alt=Sign in border=0 width=67
height=20 tabindex=4 class=img_button id=submit /gt;

with the submitLoginForm() function attached, but works fine with this:

lt;input type=image name=submit id=submit
value=Sign in src=images/sign-in.gif tabindex=4 /gt;

with the same function attached.

I'm rather bummed by this because it leaves me with a very ugly button with
daggy jaggedy edges.


-- 
View this message in context: 
http://www.nabble.com/Form-not-submitting-tf3025179.html#a8421157
Sent from the JQuery mailing list archive at Nabble.com.


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


Re: [jQuery] Form not submitting

2007-01-17 Thread Olaf Bosch
Mungbeans schrieb:

 Thanks, Olaf.  Since last posting I reworked the javascript (pretty much as
 you said):

Your image replace are shit. Looks so:

$(#submit-container).empty().append(input type=\image\ 
src=\images/signin.png\ AND SO ON  /);

ATTENTION!!! - in Scripts are bad, see image name

For what is this good? You have this in posted HTML!?

-- 
Viele Grüße, Olaf

---
[EMAIL PROTECTED]
http://olaf-bosch.de
www.akitafreund.de
---

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


Re: [jQuery] Form not submitting

2007-01-17 Thread Mungbeans


Olaf wrote:
 
 For what is this good? You have this in posted HTML!?
 

I'm not sure I understand this question or its tone.  I posted into Nabble
in text.   I have to remember to replace the lt: and gt; so it doesn't
print out as html.   Pity Nabble doesn't have a quote or code button to wrap
around html and code.

I'll bear the - tip in mind.
-- 
View this message in context: 
http://www.nabble.com/Form-not-submitting-tf3025179.html#a8421959
Sent from the JQuery mailing list archive at Nabble.com.


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


Re: [jQuery] Form not submitting

2007-01-17 Thread Olaf Bosch
Mungbeans schrieb:
 
 Olaf wrote:
 For what is this good? You have this in posted HTML!?
 
 
 I'm not sure I understand this question or its tone.  I posted into
 Nabble in text.   I have to remember to replace the lt: and gt; so
 it doesn't print out as html.   Pity Nabble doesn't have a quote or
 code button to wrap around html and code.

I follow the mails per Thunderbird, all the same of write lt; or ,
better for copy is  and 

Sorry, the tone is not bad meant.

I ask why you replace in script a gif in a png and not use the
png in HTML!? ( !? == rhetorical ask == no answer necessarily ) ;)


-- 
Viele Grüße, Olaf

---
[EMAIL PROTECTED]
http://olaf-bosch.de
www.akitafreund.de
---

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


Re: [jQuery] Form not submitting

2007-01-17 Thread Mungbeans



Olaf wrote:
 
 I ask why you replace in script a gif in a png and not use the
 png in HTML!? ( !? == rhetorical ask == no answer necessarily ) ;)
 

I was playing around with the image formats seeing if they made to a
difference to the way they displayed.  The images were exactly the same. 
The image format didn't make a difference, unfortunately.

!? == rhetorical ask
And there is another convention I wasn't aware of.  
-- 
View this message in context: 
http://www.nabble.com/Form-not-submitting-tf3025179.html#a8422462
Sent from the JQuery mailing list archive at Nabble.com.


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


Re: [jQuery] Form not submitting

2007-01-16 Thread Dave Methvin
 Form validation works properly but if the fields 
 are ok then the form isn't submitting. 

You want to call the submit method of the form element. Your selector
doesn't look right, there is a space between form and #login. If the form
has an id of login, do this:

$(#login)[0].submit();

The jQuery submit() method calls any submit event handler on the form, but
doesn't submit the form. (Let the debate begin.)




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


Re: [jQuery] Form not submitting

2007-01-16 Thread Karl Rudd
Try $(#login).submit(); or $(form#login).submit();

$(form #login) tries to find an element with an ID of login INSIDE a
form, rather than the form itself.

Karl Rudd

On 1/17/07, Mungbeans [EMAIL PROTECTED] wrote:

 I'm posting this in the hope that the mere act will help me work out what it
 is I'm doing wrong.  I have a form:

 form action=index.php
 method=post name=login id=login
 ..etc.
 /form

 with a button that call up the validation function:

 function submitLoginForm() {
 if ( ($(#username).val()== ) || ($(#passwd).val()== )) {
 alert (Please complete the username and password fields.);
 } else {
 $(form #login).submit();
 }
 }

 Form validation works properly but if the fields are ok then the form isn't
 submitting.  Probably something obvious...
 --
 View this message in context: 
 http://www.nabble.com/Form-not-submitting-tf3025179.html#a8404162
 Sent from the JQuery mailing list archive at Nabble.com.

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


Re: [jQuery] Form not submitting

2007-01-16 Thread Mungbeans



dave.methvin wrote:
 
 
 The jQuery submit() method calls any submit event handler on the form, but
 doesn't submit the form. (Let the debate begin.)
 
 

Ahh, that explains it.  There isn't a submit button on the form.   I have an
image that triggers the validation.

So... is there a way to get the form to submit without that.  Perhaps I
should have a hidden submit button?

-- 
View this message in context: 
http://www.nabble.com/Form-not-submitting-tf3025179.html#a8404449
Sent from the JQuery mailing list archive at Nabble.com.


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


Re: [jQuery] Form not submitting

2007-01-16 Thread Mungbeans



dave.methvin wrote:
 
 
 $(#login)[0].submit();
 
 

Unfortunately that doesn't work either. In firebug I get:
$(#login)[0].submit is not a function

I get the same error with
document.login.submit();



-- 
View this message in context: 
http://www.nabble.com/Form-not-submitting-tf3025179.html#a8404754
Sent from the JQuery mailing list archive at Nabble.com.


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