Thanks Kavin and Gertjan! It worked as I needed! Leonardo J. Tramontina
"Gertjan Klein" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Leonardo J. Tramontina wrote: > > >How will I create a CSP page based on a CSP class? > > You rewrite it. In the case of your example, it makes some sense to do > so. Just create a new CSP page (don't use the form wizard), and start > typing. Based on the example code you posted, the page could look > something like this: > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> > <html> > <head> > <title></title> > </head> > > <body> > > <p>ID: #(%request.Get("OBJID"))#</p> > > <form name="form" method="post" action="#(%request.URL)#"> > <table border=1> > <csp:loop counter=z from=#(beg)# step=#(gap)# to=#(end)#> > <tr> > <td><input type='radio' value='#(z)#' name='horario'></td> > <td>#($zt(z,2))#</td> > </tr> > </csp:loop> > </table> > </form> > > </body> > </html> > > <script language=cache method=OnPreHTTP returntype="%Boolean"> > Set med=##class(User.T1).%OpenId(%request.Get("OBJID")) > Set beg=med.Begin > Set gap=med.Gap > Set end=med.End > Kill med > Quit 1 > </script> > > > As you can see, this CSP page mostly just contains HTML, with some > server-side substitutions (the stuff between #(...)#). I have placed > the setup code (opening the object and retrieving some values from it) > in a callback called OnPreHTTP. This code will automatically be > executed before the page is being rendered. You should probably do > some error checking there; what if no OBJID is passed, or the object > can't be opened for whatever reason? In OnPreHTTP, you can test for > these conditions and redirect to an error page, if you wish, by > setting %response.Redirect=<URL>. > > HTH, > Gertjan. > > -- > Gertjan Klein
