Re: Click in page directly send to server? - WeOnlyDo Discussion board

Re: Click in page directly send to server? (General questions)

by wodDamir, Thursday, November 19, 2009, 12:25 (5271 days ago) @ dirk

Dirk,

Here is an example of using one checkbox which triggers Post (thru JavaScript) and checks it if unchecked (and vice-versa):

[code]Dim response As String
If req = /page.htm Then
If user.Request.Posted.Count > 0 Then
If user.Request.Posted.Exists( C1 ) Then
response = response & <html><body>
response = response & <form name= check1 method= POST action= page.htm >
response = response & <p><input type= checkbox name= C1 onclick= mySubmit(); CHECKED></p>
response = response & </form></body>
response = response & <script type= text/javascript language= javascript >
response = response & function mySubmit()
response = response & {
response = response & document.forms(0).submit();
response = response & }
response = response & </script></html>
End If
Else
response = response & <html><body>
response = response & <form name= check1 method= POST action= page.htm >
response = response & <p><input type= checkbox name= C1 onclick= mySubmit(); ></p>
response = response & </form></body>
response = response & <script type= text/javascript language= javascript >
response = response & function mySubmit()
response = response & {
response = response & document.forms(0).submit();
response = response & }
response = response & </script></html>
End If
End If
user.response.Body = response
user.response.StatusCode = OK
user.response.Send[/code]

As for Authentication, you can simply set Authentication property to authRequired, and AuthenticationType to Basic, and server will require your users to log in. Once provided, UserAuthenticate event is raised, and you can allow or deny user access.

Hope this helps.

Regards,
Damba


Complete thread: