Jump to content

ajax php to mysql


thereal.jb

Recommended Posts

Hi guys,

 

I have this form

<form class="messagesForm" action="/order/">

    <h3>Compose a new ajax message</h3>

    <div><label>Subject:</label><input id="subject" type="text" size="30" /></div>

    <div><label>Message:</label><textarea id="description" rows="4" cols="40" ></textarea></div>

    <div id="button" style="visibility:hide;"><input class="button" type="submit" value="Add New Message" onclick="ajaxRequest.addMessage();return false" /></div>

</form>

and I need to submit it without the submit button

 

(it doesn't need to pass any markup validation or anything because it's just an intranet site)

 

Thanks guys

Link to comment
Share on other sites

the way i do it for my login in script is to pass an onKeyPress attribute to a text box through this javascript:

 

<script language="javascript"> 
/* Check submitbyenter starts */
/* Note: Use In Control Attribute as onKeyPress="return submitbyenter('frmLogin',this, event)" */
function submitbyenter(formid,myfield, e, dec)
{
var key;
var keychar;
if (window.event)
key = window.event.keyCode;
else if (e)
key = e.which;
else
return true;		
if (key==13)
{		
	GetLogin('frmLogin');
	//$(formid).submit();			
}	
}
/* Check submitbyenter ends */
</script>

 

and this is my onkeypress attribute:

onKeyPress="return submitbyenter('frmLogin',this, event)"

 

granted you'll have to edit it to fit your own needs, but thats basically it.  and it will submit without a button

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.