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
https://forums.phpfreaks.com/topic/208456-ajax-php-to-mysql/
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
https://forums.phpfreaks.com/topic/208456-ajax-php-to-mysql/#findComment-1089650
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.