To obtain values from fields in a web page.
Hi everyone,
I am in the process of developing a web based application. I am able to
successfully convert my windows to web page documents.
I have sincerely followed the prescribed steps to be adopted in building
methods for validations and processes, so as to utilise them for my web
pages too.
But the problem that I am facing is to obtain values back from the web
page fields (user entered values) for performing validations.
Unfortunately the explanations provided in the Forte Web SDK Manual
for obtaining the values from the web page fields and load it on to the
source window through LoadParameters() method (a method in the window
converter class of HTMLWindow project) seems to be inadequate.
If some one can site the steps that Iam probably missing or some
examples, it will be of great help.
Thanks in advance.
Pamella.
Get Your Private, Free Email at <a href=
"http://www.hotmail.com">http://www.hotmail.com</a>
[1065 byte] By [
] at [2007-11-25 5:01:22]

Hi, Pamella --
It might be easier to help if you could be a little more specific about
what went wrong (ie, the problematic code snippet and the resulting error
message), or what exactly you were trying to do. In any event, it is very
easy in WebEnterprise to pass values up to Forte from web pages. You can
embed them in HTML "hidden" tags or they can accompany standard form
elements.
For instance, say you have the following HTML code ...
--
<form method="POST" action="$$FORTE.ExecURL">
<input type="hidden" name="ServiceName" value="TestService">
<input type="hidden" name="TemplateName" value="nextpage.htm">
<input type="hidden" name="hiddenParam" value="dog">
<div align="center"><center>
<p>
Type some junk here: <input type="text" name="junkTxt" size="20">
</p>
</center></div>
<div align="center"><center>
<p>
<input type="submit" value="Submit" name="submitBtn">
<input type="reset" value="Reset" name="resetBtn">
</p>
</center></div>
</form>
-
In addition to what the user types into the text box (junkTxt), say you want
to pass "dog" up to Forte as a hidden parameter (hiddenParam) (hey, done't
ask me why!). You can retrieve these values up in Forte in the HandleTag
method of your scanner service by invoking "FindNameValue" on
request:HTTPRequest, ie
firstItem:TextData = request.FindNameValue('junkTxt');
secondItem:TextData = request.FindNameValue('hiddenParam');
firstItem now contains the value of "junkTxt" and secondItem contains
"dog." You can now do whatever you like with these guys, including putting
them in a ResultSet to be displayed on "nextpage.htm"
Hope this helps,
Dan
--
************************
Dr. Daniel Marcus
Sage IT Partners, Inc.
353 Sacramento St., Suite 1360
San Francisco, CA 94111
415.392.7243 x357
Daniel.Marcus@sageIT.com
at 2007-6-29 9:20:51 >

Hi Dan,
Thanks for your assistance.
But as regards to my application, I have an existing forte application
which Iam trying to web enable.
To summarize my problem let me just consider the openning window (logon
screen) which I have converted to web page using WindowConverter Class
in the HTMLWindow project (obviously, it is my supplier project). The
functionality of this window class has to just accept the user name and
validate it. If the user name is valid then proceed further else
display an error message. I have a separate validation method for the
user name, which I can utilise to validate the user name typed by the
user on the web page, if Iam browsing or on the window, if Iam directly
running the application.
The widgets on the window are <UserId> and <ProceedButton> with
window attribute names as UserId and ProceedButton respectively.
Now my handle request method goes like this :
-- This method is the entry point from the Internet to my
-- application. It is automatically called when a request
-- from the Web arrives.
response : HTTPResponse = new;
-- Find the page name.
pageName : TextData = new;
pageName.SetValue(request.PageName);
-- Generate response pages.
if pageName.IsEqual('processquery',IgnoreCase=TRUE) then
-- Please note that I have not write any HTML to build my web page.
-- Instead Iam using the WindowConverter Class to convert my existing
-- windows on the fly to web pages during run time.
w : LogonWindow = new;
-- my logon window class
Converter : WindowConverter = new(sourceWindow=w);
Converter.AssignButton(sourceField = w.<ProceedButton>,type =
'submit');
loginURL : TextData = self.CGIURL.Clone(deep=TRUE);
loginURL.Concat('?serviceName=').concat('appweb');
loginURL.Concat('&pageName=PwdPage');
w.<ProceedButton>.HTMLLink = loginURL.value;
-- Proceed button is on my window to which
-- I have associated the above HTMLLink
-- This link does not submit the User Name typed by the
-- User browsing my web page, but this User Name has to
-- come as part of the request from the browser to perform the
-- validation, as Iam not sure about obtaining the User name
-- from the web page.
-- My problem is how to get this user name?
html : HTHtml = new;
head : HTHead = new;
body : HTBody = new;
-- Give the page a title.
head.Add(HTTitle(Text='Application For The Web'));
html.Add(head);
form : HTForm = New();
body.Add(Converter.WindowToForm(Action=self.CGIURL,HTMethod='POST'));
html.Add(body);
response.AssignResponse(html.ConvertToString());
elseif pageName.IsEqual('PwdPage',IgnoreCase=TRUE) then
w : LogonWindow = new;
Conv : WindowConverter = new(sourceWindow=w);
button : PushButton = new();
button = Conv.LoadParameters(request,w.<UserId>);
-- This will fail because the 'Request' has no user Id.
-- Here, the explanation provided in the Forte Web SDK manual for
-- LoadParameters method (method from WindowConverter Class) seems to
-- be inadequate.
If w.UserId <> Nil And w.UserId.Value <> '' And w.UserId.LengthToEnd()
> 0 Then
If SQLsSO.IsValidUserId(w.UserId) Then
--Method to validate the user Name.
w1 : PasswordWindow = new;
Converter : WindowConverter = new(sourceWindow=w1);
Converter.AssignButton(sourceField = w1.<ProceedButton>,type =
'submit');
pwdURL : TextData = self.CGIURL.Clone(deep=TRUE);
pwdURL.Concat('?serviceName=').concat('appweb');
pwdURL.Concat('&pageName=MessagesPage');
-- and here I will have to get the password typed in by the User.
-- once again my same problem?
w1.<ProceedButton>.HTMLLink = pwdURL.value;
html : HTHtml = new;
head : HTHead = new;
body : HTBody = new;
-- Give the page a title.
head.Add(HTTitle(Text='Application For The Web'));
html.Add(head);
form : HTForm = New();
body.Add(Converter.WindowToForm(Action=self.CGIURL,HTMethod='POST'));
html.Add(body);
response.AssignResponse(html.ConvertToString());
Else
-- Generate an exception for unknown page.
..............
..............
..............
..............
..............
.............. and etc.
In your example, you had sighted about the 'Junktxt'. How does it comes
as part of the request from the browser and what is the reference
associated with the submit button?
If you need further clarifications, please write to me. Iam also still
working on it.
Thanks in advance,
Pamella.
You Wrote :
>Hi, Pamella --
>
>It might be easier to help if you could be a little more specific
about
>what went wrong (ie, the problematic code snippet and the resulting
error
>message), or what exactly you were trying to do. In any event, it is
very
>easy in WebEnterprise to pass values up to Forte from web pages. You
can
>embed them in HTML "hidden" tags or they can accompany standard form
>elements.
>For instance, say you have the following HTML code ...
>--
><form method="POST" action="$$FORTE.ExecURL">
><input type="hidden" name="ServiceName" value="TestService">
><input type="hidden" name="TemplateName" value="nextpage.htm">
><input type="hidden" name="hiddenParam" value="dog">
>
><div align="center"><center>
><p>
>Type some junk here: <input type="text" name="junkTxt"
size="20">
></p>
> </center></div>
>
><div align="center"><center>
><p>
><input type="submit" value="Submit" name="submitBtn">
><input type="reset" value="Reset" name="resetBtn">
></p>
> </center></div>
></form>
>-
>
>In addition to what the user types into the text box (junkTxt), say you
want
>to pass "dog" up to Forte as a hidden parameter (hiddenParam) (hey,
done't
>ask me why!). You can retrieve these values up in Forte in the
HandleTag
>method of your scanner service by invoking "FindNameValue" on
>request:HTTPRequest, ie
>
> firstItem:TextData = request.FindNameValue('junkTxt');
> secondItem:TextData = request.FindNameValue('hiddenParam');
>
>firstItem now contains the value of "junkTxt" and secondItem contains
>"dog." You can now do whatever you like with these guys, including
putting
>them in a ResultSet to be displayed on "nextpage.htm"
>
>Hope this helps,
>Dan
Get Your Private, Free Email at <a href=
"http://www.hotmail.com">http://www.hotmail.com</a>
at 2007-6-29 9:20:51 >
