SpeedScript

Hi,

I'm building an application in WebSpeed. I have connected to the database en now I would like to retrieve data from the database and display this in comboboxes for example.
I would also like to see some standard SpeedScript code. So with the tags and all. It's a bit confusing so if you guys know a source where SpeedScript is discussed in detail, please let me know.

Thank u very much.

Greetings.
 

vinod_home

Member
you should be able to get help from
http://amduus.com/4glwiki/

but amduus is down right now, I couldnt connect.

Also scroll all the way down your post till the end of the page and you will find "similar threads" previous topics of speedscripts..
 
vinod_home said:
you should be able to get help from
http://amduus.com/4glwiki/

but amduus is down right now, I couldnt connect.

Also scroll all the way down your post till the end of the page and you will find "similar threads" previous topics of speedscripts..

Hi,

thanks for your reply.
I have heard of amduus.com and even visited it but like you I also couldn't connect.
I will try later.
In the mean time I will follow your advice and check those links out.
 

Casper

ProgressTalk.com Moderator
Staff member
Code:
<select name="somename" size="1">
<% FOR EACH tablename: %>
<option value="<%=tablename.ct_value%>" <%=STRING(getSession("somename")= tablename.ct_value,"selected/")%>> <%=table-name.ct_description%> </option>
<% END. %>
</select>

I just wrote it down, so may need some adjustments :) But anyway, this the idea how to do this.

In the underlying dispatch procedure I put the get-value('somename') in a session file and retrieve it with getSession to select the right entry of the combo-box after each return to the page....

HTH,

Casper
 
Casper said:
Code:
<select name="somename" size="1">
<% FOR EACH tablename: %>
<option value="<%=tablename.ct_value%>" <%=STRING(getSession("somename")= tablename.ct_value,"selected/")%>> <%=table-name.ct_description%> </option>
<% END. %>
</select>
I just wrote it down, so may need some adjustments :) But anyway, this the idea how to do this.

In the underlying dispatch procedure I put the get-value('somename') in a session file and retrieve it with getSession to select the right entry of the combo-box after each return to the page....

HTH,

Casper

Hi Casper,

Thanks for your time and effort to put some code.
I already have a solution thanks to my mentor. He suggested:

<select size="1" name="D2">
<script language="SpeedScript">
FOR EACH 'tablename' NO-LOCK:
{&OUT} "<option>" 'tablename.tabelfield' "</option>".
END.
</script>
</select>

It works fine, there was another way where you'll use expression escapes.

Now I have another far more bigger problem.
I now must make een login page wich verifies username and password. But also stores a cookie so that de user can navigate through the webspeed application and check if the user is logged in or not. If not then the user should login again (jump to login page).

U guys have an example of this?

Thanks in advance.

Greetings.:)
 

Casper

ProgressTalk.com Moderator
Staff member
Hi,

If you configure your messenger in such way that you use Session connection ID then you don't have to create a cookie explicitly. Standard sessionmanagement included with WebSpeed uses session connection id to generate a unique id for that session. If you use that then you can use SetSession and getSession functions to retrieve information regarding the session.

Let's say a session is started. As soon as you do SetSession('namevariable',value) a textfile is created with this value in it. You can retrieve this value with the GetSession('namevariable') function.
With this you can verify if the session is valid or not (return to login page). Any text can be put in the session file as long if it doesn't exceed 32K in total.

HTH,

Casper.
 
Casper said:
Hi,

If you configure your messenger in such way that you use Session connection ID then you don't have to create a cookie explicitly. Standard sessionmanagement included with WebSpeed uses session connection id to generate a unique id for that session. If you use that then you can use SetSession and getSession functions to retrieve information regarding the session.

Let's say a session is started. As soon as you do SetSession('namevariable',value) a textfile is created with this value in it. You can retrieve this value with the GetSession('namevariable') function.
With this you can verify if the session is valid or not (return to login page). Any text can be put in the session file as long if it doesn't exceed 32K in total.

HTH,

Casper.

I've coded a simple block which verifies if the user has entered the userid and password. This is done so I can go program the remaining functionalities in my system. I will begin on the original problem later.

Now another problem, say you now after loggin in, you go to a page where there information to be filled like incident description, solution etc.
At the top of the screen there are 2 forms which should automatically fill the userid (no passwords ofcourse :)) and the username (all from a database).
How to program the code? It's abit the same as filling thos comboboxes however I get stuck.

Here's the code:



<script language="SpeedScript">
Find customer where customer.numb = get-value("numb") NO-LOCK no-error.
IF available customer THEN do:
{&OUT} "<tr>" string(customer.numb).
END.
</script>
<td width="64">
<span style="background-color: rgb(255, 255, 0)">" UserID: </span></td>
<td width="148">" "<input type="text" name="T2" size="20"></td>
</tr>
<tr>
<td width="64">
<span style="background-color: rgb(255, 255, 0)">Username:</span></td>
<td width="148"> <input type="text" name="T3" size="20"></td>
</tr>

The names of the forms are T2 and T3 as shown above. and the form name numb is the field where in the customer ID was entered from the login page.

Any ideas?
 

Casper

ProgressTalk.com Moderator
Staff member
Hi,

First of all I believe it's important for every project to start good.
Which means that you have a clear picture of what you want to do. There must be a solid foundation of the way the application is build. With WebSpeed applications sessionmanagement is a very important part.
If you decide to do stuff like session management later then chances are you have to rewrite your whole application.
Examples of how to do this can be found at freeframeworks for example:

http://freeframework.org/articles/intro-ffw.shtml

Another important part of programing in WebSpeed is knowledge of HTML, Javascript (and css):

http://www.w3schools.com/html/default.asp
http://www.w3schools.com/js/default.asp
http://www.w3schools.com/css/default.asp

If the project you're going to work on is a big project then PS-eScript is also very interesting. It's a project form Progress UK. The project is open source but the catch is you have to take 5 days consultancy from Progress to get it ;-) But I have to admit it is a very good framework which can save lots of time.

Most of the WebSpeed applications I know have one central 'dispatch' procedure which dispatches the request from the webpage. This central part is used to determine the flow of the pages. What page is run under what conditions. This can also be the central part to check for validity of logins.

Now, back to your question:

Note: If you use HTML then form is the part you post. e.g. <form method="post>HTML page</form>"

I always use post because of the URL (I don't like the &-stuff).

The input tag has an atribute called value if you want to put a name in an input tag then you do something like:

<input name="something" value="<%=customer.name>">

Regards,

Casper.
 
Top