What language are you coding in? You will probably have to modify the code snippet (which is C#.net, I think) that Abhishek provided to fit the syntax of whatever language your form is using.
If you don't know what language your using and haven't changed anything from default, you are using JScript, and would need to modify your code like this:
var response = XDocument.UI.Confirm( "Hello", 4 );
if( response == 6 )
{
// write code to submit
}
This is documented in the InfoPath SDK, which is available from the link on the left side of this website.
---------------
Matt Faus
InfoPath Dev Texas
Matt Faus / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge