Jump to content
cra2sh

form.submit() + jQuery

Recommended Posts

cra2sh

Boas, estou a tentar enviar um formulário para um *.php mas não consigo colocar esta coisa a funcionar correctamente, alguém podia dar uma vista de olhos?

O script não está a aguardar pelos dados da msgbox, eu já tentei fazer um return mas sem sucesso :)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="http://s3.envato.com/files/3402416/javascript/msgbox/jquery.msgbox.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="http://s3.envato.com/files/3402416/javascript/msgbox/jquery.msgbox.min.js"></script>
<script>
$(document).ready(function()
{
$('#message').submit(function()
{
	$.msgbox('De : <b>' + $('#from').val() + '</b><br/>Para : <b>' + $('#to').val() + '</b><br />Mensagem : <br /><textarea cols="35" rows="2" style="resize:none"></textarea>',
	{
		type: 'info',
		buttons :
				[
					{type: 'submit', value: 'Enviar'},
					{type: 'cancel', value: 'Cancelar'}
				]
		}, function(result)
		{
			if (result == false)
			{
				return false;
			}

			else
			{
				return true;
			};
	});
});
});
</script>
<title>Demo</title>
</head>
<body>
<form method="post" action="send.php" id="message">
<table border="0">
	<tr>
        	<td>De:</td>
		<td><input type="text" id="from"></td>
	</tr>
	</tr>
            <td>Para:</td>
            <td><input type="text" id="to"></td>
	</tr>
	<tr>
        	<td> </td>
		<td align="right"><input type="submit" value="Enviar"></td>
	</tr>
</table>
</form>
</body>
</html>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. 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.