Currently viewing: GipsySoft » Front Page» QHTM

funcQHTMFORMCallback

typedef void (CALLBACK *funcQHTMFORMCallback)( HWND hwndQHTM, LPQHTMFORMSubmit pFormSubmit, LPARAM lParam );

Type used when a user hits submit on a form that uses POST.

Form POSTs cannot be submitted by QHTM directly because QHTM doens't have networking capabilities yet. So QHTM gives you the form data to do with as you please. You could use WinINet to send the data to your server.

Example

Here's an example that displays a QHTM MessageBox with the form results. This code has been taken form the QHTM demo.

void MyFORMCallback( HWND hwndQHTM, LPQHTMFORMSubmit pFormSubmit, LPARAM )
{
	HWND hwnd = GetParent( hwndQHTM );
	TCHAR szMain[ 20480 ];	//	20KB should be enough.
	wsprintf( szMain,
	  _T("<h1>QHTM form %s</h1>QHTM FORMs 'post'.<p>Form: <i>%s</i>")
		_T("<p>With the following fields:")
		_T("<table border=1 width='200' cellpadding=5><tr><td nowrap><b>")
		_T("Field name</b></td><td nowrap><b>Field value</b></td></tr>")

		, pFormSubmit->pcszName, pFormSubmit->pcszAction );

	for( UINT u = 0; u < pFormSubmit->uFieldCount; u++ )
	{
		TCHAR szField[ 1024 ];
		wsprintf( szField, _T("<tr><td>%s</td><td>%s</td></tr>")
		  , pFormSubmit->parrFields[ u ].pcszName
			, pFormSubmit->parrFields[ u ].pcszValue );
		_tcscat( szMain, szField );
	}
	_tcscat( szMain, _T("</table>") );

	QHTM_MessageBox( hwnd, szMain, _T("QHTM Form Submit"), MB_OK );
}

See also struct QHTMFORMSubmit