NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: oggy on October 04, 2011, 04:07:04 AM

Title: SetFormAction routine
Post by: oggy on October 04, 2011, 04:07:04 AM
I need to change SetFormAction routine...
After some hours of examinating, I decide to omit default SetFormAction routine and call my SetFormAction from within local routine, with some condition:
Example:
If loc:logok = 1
  loc:FormAction = p_web.GetValue('onsave')
  If loc:formaction = 'stay'
    loc:FormAction = p_web.Requestfilename
  Else
    loc:formaction = 'IndexPage'
  End
  if p_web.IfExistsValue('ChainTo')
    loc:formaction = p_web.GetValue('ChainTo')
    p_web.SetSessionValue('LoginForm_ChainTo',loc:FormAction)
    loc:formactiontarget = '_self'
  ElsIf p_web.IfExistsSessionValue('LoginForm_ChainTo')
    loc:formaction = p_web.GetSessionValue('LoginForm_ChainTo')
    loc:formactiontarget = '_self'
  End
  If loc:FormActionTarget = ''
    loc:FormActionTarget = '_self'
  End
  If loc:formaction = ''
    loc:formaction = lower(p_web.getPageName(p_web.RequestReferer))
  End
  loc:FormActionCancel = 'Login.html'
  loc:FormActionCancelTarget = ''
end
-------------------------------------
but this didnt work...
My goal to call 'IndexPage' only when condition (loc:logok) is true...
After fetching data from logging database, loc:logok is set to true, I check this out, but local routine did not open IndexPage as expected....
Any hint on that?

Title: Re: SetFormAction routine
Post by: kevin plummer on October 04, 2011, 07:03:40 PM
Rather than changing this I would do the validation in the _sendFile embed in the web handler in which you can simply serve up a different page than what was called. Bruce describes the method in his book - Building Web Apps.

I used recently and it works a treat!
Title: Re: SetFormAction routine
Post by: oggy on October 04, 2011, 09:55:54 PM
Any link to that?
Title: Re: SetFormAction routine
Post by: Bruce on October 05, 2011, 05:24:31 AM
http://www.capesoft.com/accessories/nettalkwebbooksp.htm (http://www.capesoft.com/accessories/nettalkwebbooksp.htm)