Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   indy (post) edit-felder ausfüllen, submit-button drücken (https://www.delphipraxis.net/75889-indy-post-edit-felder-ausfuellen-submit-button-druecken.html)

broting 26. Aug 2006 16:46


indy (post) edit-felder ausfüllen, submit-button drücken
 
hallo alle miteinander,

ich möchte mich zunächst einmal vorstellen: mein name ist markus, ich bin 17 jahre alt und komme aus dem raum bonn und umgebung.

da ich gerne programmiere und mich jetzt einmal in die des internets vortasten möchte habe ich mich entschieden ein ACARS-programm für den MSFS2004 zu schreiben.

In kurform sieht mein derzeitiger stand nun so aus:

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    IdHTTP1: TIdHTTP;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

uses IdMultipartFormData;


{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
data: TIdMultiPartFormDataStream;
e:string;
begin
data := TIdMultiPartFormDataStream.Create;
try
data := tidmultipartformdatastream.Create;
data.AddFormField('Password','meinpw');
data.AddFormField('Username','meinbn');
e:=IdHTTP1.Post('http://****.**/check_user_inc.asp', data);
idhttp1.AllowCookies:=true;
idhttp1.HandleRedirects := true;
data := tidmultipartformdatastream.Create;
data.AddFormField('Dep','EDDF');
data.AddFormField('Arr','KIAD');
data.AddFormField('Flight','LH418');
data.AddFormField('DepTime','1400');
data.AddFormField('Ac','300B2');
data.AddFormField('ArrTime','1500');
data.AddFormField('FlightTime','7.1');
data.AddFormField('Alt','330');
data.AddFormField('Speed','.85');
data.AddFormField('Comments','ACARS USED _ TEST ONLY!!');
showmessage(IdHTTP1.Post('http://www.****.**/logbook.asp?mode=add', data));

finally
data.Free;
end;

end;

end.
soweit funktioniert auch alles wunderbar - zumindest krieg ich keine fehlermeldung :bounce1:

allerdings werden die meine per post-methode angefügten daten irgendwie nicht benutzt :(

ich denke mal, dass das daran liegt, dass diese werte dann nicht submitted werden :gruebel: , nur wie schafft man das??

hier mal kurz entsprechende "prozedur" eines .asp-dokumentes: (logbook.asp?mode=add - damit werden die pilotenreports eingefügt. manuell gebe ich in editboxen meine daten ein und drücke auf den submit-button. schon ises in der datenbank)

Code:
<form method="POST" action="Logbook.asp" name="Form1" onsubmit="return Form_Validator(this)" language="JavaScript"><input type=hidden name=mode value="e_add">
       

</p>
        <div align="center">
          <center>
          <table border="0" cellspacing="1" width="450" id="AutoNumber11" style="border-collapse: collapse">
            <tr>

              <td align="center" bordercolor="#000000" height="22" colspan="2">[b]<font size="2">MANDATORY FIELDS
                :</font>[/b]</td>
            </tr>
            <tr>
              <td align="left" bordercolor="#000000" height="22"><font size="1">[b]
              Departure: [/b](VHHH for Hong Hong, EGLL for London Heathrow etc.)
                </font></td>
              <td align="center" bordercolor="#000000" height="22">
            <font color="#FFFFFF">

            //Das Zeugs dazwischen hab ich mal weggemacht ...
            <tr>
              <td align="left" bordercolor="#000000" height="22"><font size="1">[b]Comments: [/b]
                </font></td>
              <td align="center" bordercolor="#000000" height="22"><font color="#FFFFFF">
              <input type="text" name="Comments" size="20"></font></td>
            </tr>
           
          </table>

          </center>
        </div>
        <p align="center" style="margin-top: 0; margin-bottom: 0">[b]
       
        <font face="Verdana" color="#FF0000">


        BY HITTING SEND:</font>[/b]</p>
        <p align="center" style="margin-top: 0; margin-bottom: 0">
        <font color="#FF0000">[b]
        You AGREE that the PIREP you are about to send is
        honest and accurate and is applying the flying rules explained in our New Pilots section.[/b]</font></p>

        <p align="center" style="margin-top: 0; margin-bottom: 0"></p>
        <p align="center" style="margin-top: 0; margin-bottom: 0">
        <font size="1">[b]After you send this PIREP:[/b]</font></p>
        <p align="center" style="margin-top: 0; margin-bottom: 0">
        <font size="1">Please [b]VERIFY[/b] that the database has been updated.Check the first entry at the top of Flight Reports,
        and as appropriate cross-check with your logbook.</font></p>
        <p align="center" style="margin-top: 0; margin-bottom: 0"></p>

        <p align="center" style="margin-top: 0; margin-bottom: 0">
        <font size="1">Need help? Contact us at </font>
        <font color="#FFFFFF" size="1">
        <a href="mailto:****" style="text-decoration: none">
        ****</a></font></p>
        <p align="center"><font color="#FFFFFF">
        <input type="submit" value="Send PIREP" name="Submit"><input type="reset" value="Clear" name="B2"><input type="button" value="Cancel" name="B2" onClick="location.href='?mode='"></font></p>
      </form>
die funktion return Form_Validator(this) gibt nur dann "true" aus, wenn alles richtig eingegeben wurde ... optisch gesehen sollten die richtig eingetragen werden ...

jetzt frage ich mich bloß, wie die sachen in die datenbank eingefügt werden ... kann man das hier vllt. sehen, und wenn ja, wie kann ich veranlassen, dass dies aus meinem programm heraus geht?

ist da vllt. ne möglichkeit die editor-felder "virtuell" auszufüllen und dann "virtuell" auf den button zu klicken - alles aus meinem programm heraus ...

oder ist das mit der post-methode der vollkommen falsche weg? wenn ja, wie ginge es einfacher oder anders?

ich muss dazu sagen, dass ich in diesen dingen ein vollkommener noob bin und möchte schon im voraus um verzeihung bitten.
falls hier schoneinmal ein solches topic exestierte - vergebt mir bitte, ich habe sowohl die board-suche hier, im delphi-forum.de, als auch die google-suche betätigt, allerdings nichts mir weiterhelfendes gefunden :wink:

einen schönen nachmittag/abend noch
markus


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:01 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz