RTC Forums
November 24, 2024, 01:01:45 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
get button pressed from a submit
Pages: [
1
]
« previous
next »
Print
Author
Topic: get button pressed from a submit (Read 4622 times)
clockon
RTC Expired
Posts: 22
get button pressed from a submit
«
on:
April 30, 2014, 01:16:07 AM »
hi
Is there a way I can tell which button was pressed from a page submit?
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: get button pressed from a submit
«
Reply #1 on:
May 01, 2014, 10:01:28 PM »
You can use the value tag in HTML to send different values for each SUBMIT button on a Form.
You can read the value of each variable received POST data, the same way you can read edit field values.
Here is an example of a "OnDataReceived" event (modify the QuickStart/BrowserUpload example) ...
with TRtcDataServer(Sender) do
begin
if Request.Method='GET' then
begin
Write('<html><body><form enctype="multipart/form-data" method="post">');
Write('Are you sure?');
Write('<input type="answer" value="Yes">');
Write('<input type="answer" value="No">');
Write('<input type="answer" value="Cancel">');
Write('</form></body></html>');
end
else
begin
Request.Params.AddText(Read);
if Request.Complete then
begin
if Request.Params['answer']='Yes' then
Write('You clicked YES')
else if Request.Params['answer']='No' then
Write('You clicked NO')
else
Write('You clicked Cancel?');
end;
end;
end;
Best Regards,
Danijel Tkalcec
Logged
clockon
RTC Expired
Posts: 22
Re: get button pressed from a submit
«
Reply #2 on:
May 02, 2014, 01:11:10 AM »
yep so i have to store the result of the button, thats what i thought from the dataReceived output. thanks
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...