BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Passing custom values from javascript to IW component

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Thirdparty Tools (IntraWeb)
View previous topic :: View next topic  
Author Message
Krystian
Guest





PostPosted: Fri Jul 14, 2006 8:19 pm    Post subject: Passing custom values from javascript to IW component Reply with quote



Hi,

How can I send my custom values from javascript to component (delphi).
I wrote small component that can be moved using mouse in browser. But
after movement and reloading page (eg. posting data) that position is
not posted/reloaded.
How can I send my custom value, like positions X/Y in input-hidden on in
any other way?

I know how to add (in GetInputControlNames?) that hidden input and put
there my values and modify it in JS, but how can I read that values from
delphi IW component after post it?

I noticed that procedure SetValue (interface method implementation from
IIWInputControl or IIWSubmitControl) is tiggered after post data, and in
IWCheckBox it contains On/Off value, for IWEdit it contains text value.
But I don't know how to read other my custom values.

Generally I want to add other custom values to component, that could be
reposted after page update/reload.

In documentation and in internet I didn't found any useful informations.

--
Best regards
Krystian
Back to top
jay
Guest





PostPosted: Fri Jul 21, 2006 3:36 pm    Post subject: This is how to get results back into IW component Reply with quote



Hi Krystan,

Here is a few pointers to get you on track,(hard to find support heh)
if your custom control is inherited from TIWControl make sure to
include the
following 2 variables in your components constructor ( FNeedsFormTag
:= True;
FSupportsInput := True;
) both variables are declared in IWControl so just set them to true.
ie .
constructor TIWClientSide.Create(AOwner: TComponent);
begin
inherited create(AOwner);
FNeedsFormTag := True;
FSupportsInput := True;
end;

next create some hidden fields, override the RenderHTML of TIWControl
(function RenderHTML: TIWHTMLTag; ) and inside the new declaration
add some code like

function TIWClientSide.RenderHTML: TIWHTMLTag;
begin
Result := TIWHTMLTag.CreateTag('DIV');
if assigned(Result) then
with Result.Contents.AddTag('INPUT') do
begin
AddStringParam('TYPE', 'HIDDEN');
AddStringParam('NAME', HTMLName+'MYCUSTOMPARAM');
AddStringParam('ID', HTMLName+'MYCUSTOMPARAMID');
AddStringParam('Value', 'something');
end;
end;

Lasted to access the hidden info...
after using some clientside script to change to value of the hidden tag
value
override the procedure SetValue(const AValue: string); (method of
IWControl)
which will now be called when the form your component is on is
submitted (FSupportsInput = true).

The value of TIWForm(Form).Params will contain the updated/new value of
the hidden tag,
so to gain acccess to the value(s) query the TIWForm(Form).Params list
to get the new data, ie
myclientsubmitted := TIWForm(Form).Params.Values[
HTMLName+'MYCUSTOMPARAM']
(Form is a property of TIWControl, just typecast it (make sure to in
IWForm is uses clause))
ie.
procedure TIWClientSide.SetValue(const AValue: string);
begin
myclientsubmitted := TIWForm(Form).Params.Values[
HTMLName+'MYCUSTOMPARAM']
end;

Hope this helps,

Jay

{intraweb would be a GREAT product if only it had better/real
documentation and some open source for component writers, with bigger
free/share ware component libraries it would help entice other web
developers to use the product}

Krystian wrote:
Quote:
Hi,

How can I send my custom values from javascript to component (delphi).
I wrote small component that can be moved using mouse in browser. But
after movement and reloading page (eg. posting data) that position is
not posted/reloaded.
How can I send my custom value, like positions X/Y in input-hidden on in
any other way?

I know how to add (in GetInputControlNames?) that hidden input and put
there my values and modify it in JS, but how can I read that values from
delphi IW component after post it?

I noticed that procedure SetValue (interface method implementation from
IIWInputControl or IIWSubmitControl) is tiggered after post data, and in
IWCheckBox it contains On/Off value, for IWEdit it contains text value.
But I don't know how to read other my custom values.

Generally I want to add other custom values to component, that could be
reposted after page update/reload.

In documentation and in internet I didn't found any useful informations.

--
Best regards
Krystian
Back to top
Riki Wiki
Guest





PostPosted: Sat Jul 22, 2006 1:21 am    Post subject: Re: This is how to get results back into IW component Reply with quote



Hoi Jay

Good answer you have made to Krystian, unfortunately because you posted on
Google Groups your answer is invisible to Krystian and most other people
who reads this newsgroup. You need to repost it on the Borland news server.

How to post to Delphi newsgroups:
<http://delphi.wikia.com/wiki/Delphi_Newsgroups>
Back to top
Borland
Guest





PostPosted: Sat Jul 22, 2006 1:46 am    Post subject: This is how to get results back into IW component Reply with quote

Hi Krystan,

Here is a few pointers to get you on track,(hard to find support heh)
if your custom control is inherited from TIWControl make sure to
include the
following 2 variables in your components constructor ( FNeedsFormTag
:= True;
FSupportsInput := True;
) both variables are declared in IWControl so just set them to true.
ie .
constructor TIWClientSide.Create(AOwner: TComponent);
begin
inherited create(AOwner);
FNeedsFormTag := True;
FSupportsInput := True;
end;


next create some hidden fields, override the RenderHTML of TIWControl
(function RenderHTML: TIWHTMLTag; ) and inside the new declaration
add some code like


function TIWClientSide.RenderHTML: TIWHTMLTag;
begin
Result := TIWHTMLTag.CreateTag('DIV');
if assigned(Result) then
with Result.Contents.AddTag('INPUT') do
begin
AddStringParam('TYPE', 'HIDDEN');
AddStringParam('NAME', HTMLName+'MYCUSTOMPARAM');
AddStringParam('ID', HTMLName+'MYCUSTOMPARAMID');
AddStringParam('Value', 'something');
end;
end;


Lasted to access the hidden info...
after using some clientside script to change to value of the hidden tag
value
override the procedure SetValue(const AValue: string); (method of
IWControl)
which will now be called when the form your component is on is
submitted (FSupportsInput = true).


The value of TIWForm(Form).Params will contain the updated/new value of
the hidden tag,
so to gain acccess to the value(s) query the TIWForm(Form).Params list
to get the new data, ie
myclientsubmitted := TIWForm(Form).Params.Values[
HTMLName+'MYCUSTOMPARAM']
(Form is a property of TIWControl, just typecast it (make sure
IWForm is in the uses clause))
ie.
procedure TIWClientSide.SetValue(const AValue: string);
begin
myclientsubmitted := TIWForm(Form).Params.Values[
HTMLName+'MYCUSTOMPARAM']
end;


Hope this helps,


Jay


{intraweb would be a GREAT product if only it had better/real
documentation and some open source for component writers, with bigger
free/share ware component libraries it would help entice other web
developers to use the product}



"Krystian" <krystian.bigaj (AT) gmail (DOT) com> wrote in message
news:44b7b607 (AT) newsgroups (DOT) borland.com...
Quote:
Hi,

How can I send my custom values from javascript to component (delphi).
I wrote small component that can be moved using mouse in browser. But
after movement and reloading page (eg. posting data) that position is
not posted/reloaded.
How can I send my custom value, like positions X/Y in input-hidden on in
any other way?

I know how to add (in GetInputControlNames?) that hidden input and put
there my values and modify it in JS, but how can I read that values from
delphi IW component after post it?

I noticed that procedure SetValue (interface method implementation from
IIWInputControl or IIWSubmitControl) is tiggered after post data, and in
IWCheckBox it contains On/Off value, for IWEdit it contains text value.
But I don't know how to read other my custom values.

Generally I want to add other custom values to component, that could be
reposted after page update/reload.

In documentation and in internet I didn't found any useful informations.

--
Best regards
Krystian
Back to top
jay
Guest





PostPosted: Sat Jul 22, 2006 2:11 am    Post subject: Re: This is how to get results back into IW component Reply with quote

Thanks Riki, did the repost to borland newsgroup, please excuse the
'borland' typo in the sender name, small oversight when setting up
account (all fixed).

Jay

Riki Wiki wrote:
Quote:
Hoi Jay

Good answer you have made to Krystian, unfortunately because you posted on
Google Groups your answer is invisible to Krystian and most other people
who reads this newsgroup. You need to repost it on the Borland news server.

How to post to Delphi newsgroups:
http://delphi.wikia.com/wiki/Delphi_Newsgroups
Back to top
Krystian
Guest





PostPosted: Sun Jul 23, 2006 11:48 pm    Post subject: Re: This is how to get results back into IW component Reply with quote

Borland wrote:
Quote:
Here is a few pointers to get you on track,(hard to find support heh)
if your custom control is inherited from TIWControl make sure to
include the
following 2 variables in your components constructor ( FNeedsFormTag
:= True;
FSupportsInput := True;
) both variables are declared in IWControl so just set them to true.
ie .
Ok, thank you very much. I'll try it. I did similar like this, but I

made another sub-component that store only configuration (like
x,y,z-index). And after submit it sets that values to main component. I
know that it was very *ugly* way, but without good documenation (or full
sources) it's very hard to find out proper way.

Quote:
{intraweb would be a GREAT product if only it had better/real
documentation and some open source for component writers, with bigger
free/share ware component libraries it would help entice other web
developers to use the product}
Exactly. Documentations in IW is not really documentation. Probably IW

is not so popular because lack of good documentation. When I started to
do sth. with IW it was so hard to make something what I want (dont know
how to do it in good way without documentation).


Thanks for help.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Thirdparty Tools (IntraWeb) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.