Scripting Helma
Freitag, 15. November 2002
Controlling the form behaviour

Last time our application was able to create forums, but in a VERY uncontrolled way.

.hac Helma Actions
To control the creation of new forums the user should be able to hit a link or button, which says "add a forum". This link will call a function on the server, which is adding a new forum and redirects back to the main page of our application.

.hac files are functions(), which can be called via an URL.

That means our "add a new forum" function will be a .hac file, which we can call via a link on the start page. So lets create a new .hac file, which we will call "addforum.hac" in the root directory.

apps/forum/root/addforum.hac
var aNewForum = new forum();
this.add(aNewForum);
res.redirect(root.href("main"));

and clean up the code in main.hac and add there a link:

apps/forum/root/main.hac
for (var i=0; i<this.count(); i++) {
res.write('<a href="'+this.get(i).href("main")+'">');
res.write('Forum No.'+i+'</a><br>');
}
res.write('<hr>');
res.write('<a href="'+this.href("addforum")+'">add a new forum</a><br>');;

the only line which is new is
res.redirect(root.href("main"));

This means the user is send to the page "main" in root. This is the same, as the user would click a link in hers browser.

Online for 8335 days
Last modified: 08.08.02, 10:22
Status
Youre not logged in ... Login
Menu
... Home
... Tags

Suche
Calendar
April 2024
So.Mo.Di.Mi.Do.Fr.Sa.
123456
78910111213
14151617181920
21222324252627
282930
November
Recent updates
Controlling the form behaviour Last
time our application was able to create forums, but in...
by matthias (15.11.02, 20:04)
Scripting a simple Forum In
this chapter we will script our first real Helma web...
by matthias (15.11.02, 18:37)
Adding Forums to our application
Today you will learn, how to create new forums, and...
by matthias (15.08.02, 12:27)
Hello World After we succesfully
installed Helma, we will write our first application: The traditional...
by matthias (11.08.02, 13:32)
Installing Helma Helma is 100%
Java, that means, that you can run it on a...
by matthias (08.08.02, 20:32)
How to script Helma ....
That's what you would love to know. .... RIGHT! Antville...
by matthias (06.08.02, 12:00)
How can you get involved?
Helma.org is providing a lot of gates which you can...
by matthias (06.08.02, 11:48)
first try funny, an hour
ago i first saw this tool, because i was testing...
by matthias (28.06.01, 17:20)

RSS feed

Made with Antville
Helma Object Publisher