Timer event - is there such a thing?

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Indy
Ebase User
Posts: 11
Joined: Thu Sep 13, 2007 8:20 am
Location: North Herts District Council

Timer event - is there such a thing?

#1

Postby Indy » Wed Oct 22, 2008 10:53 pm

Hi,

I'm looking for a method of polling a form and trapping an event when a field is updated. As there isn't a "timer" event in EBase, does anyone have a method of achieving this?

Thanks
0 x
Indy

User avatar
Joost
Ebase User
Posts: 49
Joined: Fri Sep 14, 2007 6:14 pm
Location: The Netherlands

#2

Postby Joost » Thu Oct 23, 2008 12:53 pm

Timer... perhaps you could add a meta refresh tag, use a javascript timer function or a cron-job and wget a form.
0 x

Indy
Ebase User
Posts: 11
Joined: Thu Sep 13, 2007 8:20 am
Location: North Herts District Council

#3

Postby Indy » Mon Oct 27, 2008 3:02 pm

Hi Joost,

Any chance you could give me some example code? I'm not a Java developer so haven't really done any Java coding.

Thanks
0 x
Indy

AJDulk
Ebase User
Posts: 94
Joined: Fri Sep 14, 2007 12:18 pm
Location: The Netherlands
Contact:

Timer event - is there such a thing?

#4

Postby AJDulk » Mon Oct 27, 2008 3:44 pm

Meta Refresh Tag - Is an HTML construct, normally used in the body tag to automatically refresh a page after a certain amount of time.

Javascript - is a scripting language understood by most browsers that run client side.

Cron Job
- is a scheduled task on of the Unix variants (Unix, Linux, BSD, ...)

wget - is a program, initially under the Unix variants but now ported to Windows as well, that downloads a web-page / site.

None of this requires pure Java programming, though Javascript is based on Java.

I have a question for you - are you trying to watch another site or are you wanting to watch your own form as a user is filling it in?

Depending on your answer to this, depends on whether Joost's answer is relevant to your question.
0 x

Indy
Ebase User
Posts: 11
Joined: Thu Sep 13, 2007 8:20 am
Location: North Herts District Council

#5

Postby Indy » Mon Oct 27, 2008 6:24 pm

Hi AJDulk,

Basically what I want to do is use the eform to collect some details from a customer (user) and then save this to a folder. I have a script which polls this folder and process the data in the file and then saves the results to a file. I want the eform to refresh itself after 30sec and see if the result file has arrived. Depending on the content of this result, the eform makes a decision on which route to take for it's conclusion.

Hope this explains my requirement.

Thanks
0 x
Indy

AJDulk
Ebase User
Posts: 94
Joined: Fri Sep 14, 2007 12:18 pm
Location: The Netherlands
Contact:

Timer event - is there such a thing?

#6

Postby AJDulk » Tue Oct 28, 2008 9:27 am

The flow as I understand it is:
1. The user fills in a form.
2. The user submits the form.
3. The form writes a file to the file system.
4. The form displays a "please wait" page.
5. Every 30 seconds on the "please wait" page the form checks to see if a new file is created / the existing file is updated with the result.
6. Once the file is updated the form continues depending on the result.

To arrange what you are wanting in the web-browser using an Ebase form, you will need to use JavaScript. You should place the JavaScript in the HTML++ tab found in the "Form properties" (this JavaScript will be available on every page of the form).

On the "please wait" page you need to check for the new / read the old file to see if the result is in. If it is then do a redirect to your next page. On the "please wait" page, there needs to be something to trigger the Timer function in your JavaScript (label or display only text field with html selected in its properties?).

To find the JavaScript use your favourite Search Engine with the terms "JavaScript Timer" (without the quotes will give the most results). Using Google.com, Yahoo.com and Cuil.com give you plenty of examples.

Be aware: There are some users that disable JavaScript in their browsers. This will thwart your functionality. You may want to have a message along the lines of "JavaScript is disabled, please wait 30 seconds and then click the button to see if the results are in" with the corresponding button that appears if JavaScript is disabled.

Regards,
Antony
0 x

Indy
Ebase User
Posts: 11
Joined: Thu Sep 13, 2007 8:20 am
Location: North Herts District Council

#7

Postby Indy » Wed Oct 29, 2008 5:00 pm

Hi AJDulk,

Thanks for the pointers...I will certainly do some searches to see what comes up.

I've just had a look at the HTML++ tab and it says in there that any code placed here will be available to all pages. Wouldn't that be a problem for me if it keeps executing the html on every page? Or is there a method of checking which page the user's on and then deciding whether to execute or not (?)

Thanks
0 x
Indy

User avatar
Joost
Ebase User
Posts: 49
Joined: Fri Sep 14, 2007 6:14 pm
Location: The Netherlands

#8

Postby Joost » Thu Oct 30, 2008 10:17 am

Indy wrote:is there a method of checking which page the user's on and then deciding whether to execute or not
Instead of using the head-section, I'd try a label-field first. Label-fields may contain html and javascript. Put this field with the JS on the page where it's needed. It should work.
0 x

AJDulk
Ebase User
Posts: 94
Joined: Fri Sep 14, 2007 12:18 pm
Location: The Netherlands
Contact:

Timer event - is there such a thing?

#9

Postby AJDulk » Thu Oct 30, 2008 10:22 am

In my last reply I mentioned this already. To quote the relevant parts:
You should place the JavaScript in the HTML++ tab found in the "Form properties" (this JavaScript will be available on every page of the form).
On the "please wait" page, there needs to be something to trigger the Timer function in your JavaScript (label or display only text field with html selected in its properties?).
The idea is though the code is available on all pages (within the form) for use, you explicitly activate it on the page(s) where you wish to use it.

Regards,
Antony
0 x


Who is online

Users browsing this forum: No registered users and 106 guests