[SOLVED] SIGSEGV on web form processing
lazarus / 38-Networking and Web Programming
----------------------------------------------------------------------
lennit · 2015-12-09 13:47
Hello,
I am playing around with Benibella's Internet tools to retrieve data
from a web form. In order to learn how to use it, I started with a
simple HTML I made and the the source code I apply. Somehow though it
gives me a SIGSEGV error when I try to use another template, other
than the one pointing to the first element on the page.
Code: Pascal [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i const
EXAMPLE_TEMPLATE :string='
{.}
{.}
*
';
temp1:string='{e1:=@value}';
temp2:string='{e2:=@value}';var Form1:
TForm1; content:string; m:integer;implementation {$R *.lfm} { TForm1
} procedure TForm1.retrieveDataClick(Sender: TObject);begin
m:=strtointdef(indexOfItem.Text,0); content:=retrieve(address.Text);
case m of 0:process(content, temp1); 1:process(content, temp2);
2:process(content, EXAMPLE_TEMPLATE); 3:process(content,
EXAMPLE_TEMPLATE); end;
responseEdit.Text:=processedVariables.get(m).toString; content:='';
processedVariables.Free;end;
This is the index.html against which I am testing it.
Code: Pascal [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i Untitled Page
20
30
It only works for the first template, in other words for the first
input box in the web page. For any other index it gives me SIGSEGV.
What am I doing wrong? Am I trying to overstep the possibilities which
Internet Tools offer?
----------------------------------------------------------------------
lennit · 2015-12-09 14:13
I got this
Instead of
Code: Pascal [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i
processedVariables.Free;I should have used
Code: Pascal [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i
processedVariables.Clear;Modifying the template to this
Code: Pascal [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i const
EXAMPLE_TEMPLATE :string='
{.}
{
.}
{.}
{.}
*
'; temp1:string='{e1:=@value}{e2:=@value}';
temp2:string='{e2:=@value}';var Form1:
TForm1; content,con1,con2,con3:string; m:integer;implementation {$R
*.lfm} { TForm1 } procedure TForm1.retrieveDataClick(Sender:
TObject);begin m:=strtointdef(indexOfItem.Text,0);
content:=retrieve(address.Text); case m of 0:process(content,
temp1); 1:process(content, temp1); 2:process(content,
EXAMPLE_TEMPLATE); 3:process(content, EXAMPLE_TEMPLATE); end;
responseEdit.Text:=processedVariables.get(m).toString; content:='';
processedVariables.clear;end;
got me out of one more SIGSEGV.
I hope that helps someone to skip the struggle implementing Internet
Tools.
----------------------------------------------------------------------
BeniBela · 2015-12-09 16:34
yeah, never call free directly, if you did not call create
----------------------------------------------------------------------
lennit · 2015-12-09 19:22
Thank you, Benibella Your tool helped me a lot with my current
project.