Thread View: borland.public.cppbuilder.internet.web
2 messages
2 total messages
Started by mrlapkoks
Fri, 16 Jul 2004 10:08
IHTMLFormElement problem
Author: mrlapkoks
Date: Fri, 16 Jul 2004 10:08
Date: Fri, 16 Jul 2004 10:08
40 lines
1896 bytes
1896 bytes
Hello!
I have html page with content something like that
...
<form action="okhtml.php" method="post">
<input type="text" maxlength="25" name="a1" value="">
<textarea name="message" rows="20" cols="77"></textarea>
<input type="submit" name="ok" value="Ok">
<input type="submit" name="cancel" value="Cancel">
</form>
...
I want to make a program that automaticly presses "Ok" or "Cancel" button
and i can do that, but problem is with parameter "value", because this
parameter is not passed to okhtml.php. How can I solve this problem?
Here is source code:
...
if(SUCCEEDED(HTMLDocument->get_all(&pAll))) {
TVariant name;
TVariant index;
IDispatch *pDisp = NULL;
name = "ok";
index = 0;
pDisp = NULL;
if(SUCCEEDED(pAll->item(name,index,&pDisp))) {
if(pDisp) {
IHTMLInputElement *pInpEl=NULL;
if(SUCCEEDED(pDisp->QueryInterface(IID_IHTMLInputElement,(LPVOID*)&pInpEl)))
{
IHTMLFormElement *fe=NULL;
pInpEl->get_form(&fe);
if(fe) { fe->submit(); fe->Release(); }
...
Thank you, MrLapkoks
Re: IHTMLFormElement problem
Author: Remy Lebeau (TeamB)
Date: Fri, 16 Jul 2004 18:06
Date: Fri, 16 Jul 2004 18:06
33 lines
1881 bytes
1881 bytes
"mrlapkoks" <mrlapkoks@yahoo.com> wrote in message
news:40f7a918$1@newsgroups.borland.com...
> I want to make a program that automaticly presses "Ok"
> or "Cancel" button and i can do that, but problem is with
> parameter "value", because this parameter is not passed
> to okhtml.php.
IHTMLFormElement::submiot() does not send the value of any submit buttons at
all. Try calling the click() method on the particular button that you want
instead, ie:
#include <utilcls.h>
TComInterface<IHTMLElementCollection> pAll;
if( SUCCEEDED(HTMLDocument->get_all(&pAll)) )
{
TVariant name = "ok";
TVariant index = 0;
TComInterface<IDispatch> pDisp;
if( SUCCEEDED(pAll->item(name, index, &pDisp)) )
{
TComInterface<IHTMLElement> pEl;
if( SUCCEEDED(pDisp->QueryInterface(IID_IHTMLInputElement,
(LPVOID*)&pEl)) )
pEl->click();
}
}
Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads