Update of the SimpleForm example
3 posts
• Page 1 of 1
Update of the SimpleForm example
In v18, if you do the following:
And define the function 'SimpleForm' as per paragraph 2.4 of HTMLRenderer User Guide:
and run the function you get the following error:
The method 'Request' does not exist in namespace 'HRUtils'. Would it be possible to get an updated version of the function 'SimpleForm' or is it the namespace 'HRUtils' that is outdated ?
Thanks in advance.
⎕SE.SALT.Load 'HRUtils'
And define the function 'SimpleForm' as per paragraph 2.4 of HTMLRenderer User Guide:
r←SimpleForm args;evt;html;req;resp;who
:If 0∊⍴args ⍝ Setup
html←'<title>A Simple Form</title>'
html,←'<form method="post" action="SimpleForm"><table>'
html,←'<tr><td>First: </td><td><input name="first"/></td></tr>'
html,←'<tr><td>Last: </td><td><input name="last"/></td></tr>'
html,←'<tr><td colspan="2"><button>Click Me</button></td></tr>'
html,←'</table></form>'
evt←'Event' 'HTTPRequest' 'SimpleForm'
'hr'⎕WC'HTMLRenderer'('HTML'html)('Coord' 'ScaledPixel')('Size'(200 400))evt
:Else ⍝ handle the callback
req←#.HRUtils.Request args ⍝ create a request from the callback args
who←req.Get¨'first' 'last' ⍝ retrieve from the form data
who←∊' ',¨who
req.Response.Content←'<h2>Welcome',who,'!</h2>' ⍝ set the content for the response
r←req.Respond ⍝ return the formatted response
:EndIf
and run the function you get the following error:
SimpleForm ''
VALUE ERROR: Undefined name: Request
SimpleForm[11] req←#.HRUtils.Request args ⍝ create a request from the callback args
The method 'Request' does not exist in namespace 'HRUtils'. Would it be possible to get an updated version of the function 'SimpleForm' or is it the namespace 'HRUtils' that is outdated ?
Thanks in advance.
-
PGilbert - Posts: 440
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
Re: Update of the SimpleForm example
Hi Pierre,
Back in May, I wrote HRUtils.Request as a cover to create an instance of HRUtils.HttpRequest. I then dutifully updated the documentation to demonstrate that and then neglected to actually push my updated version of HRUtils to GitHub. I've now updated GitHub with the latest HRUtils.
There are a couple of ways to make the SimpleForm example work.
Personally, I'd recommend you modify SimpleForm to use ⎕NEW HRUtils.HttpRequest and wait for an updated Dyalog installation image.
I hope this helps!
/Brian
Back in May, I wrote HRUtils.Request as a cover to create an instance of HRUtils.HttpRequest. I then dutifully updated the documentation to demonstrate that and then neglected to actually push my updated version of HRUtils to GitHub. I've now updated GitHub with the latest HRUtils.
There are a couple of ways to make the SimpleForm example work.
- Change the line in SimpleForm from
req←#.HRUtils.Request args ⍝ create a request from the callback args
toreq←⎕NEW #.HRUtils.HttpRequest args ⍝ create a request from the callback args
This solution doesn't require you to update HRUtils. - Update HRUtils
You can load the latest HRUtils from GitHub using HttpCommand.Fix]load HttpCommand
#.HttpCommand
HttpCommand.Fix 'github.com/dyalog/library-conga/HRUtils.dyalog'
0 #.HTUtils
Or save the file from https://raw.githubusercontent.com/Dyalog/library-conga/master/HRUtils.dyalog and then ]load the downloaded file.
This won't update HRUtils.dyalog installed in the /Library/Conga/ folder of your Dyalog installation, so, ]load HRUtils will still load the old one.
You could save HRUtils.dyalog in the /Library/Conga/ folder of your Dyalog installation (on Windows and Mac you may need to do so as an administrator) or you can wait for an updated Dyalog installation image to be made available.
Personally, I'd recommend you modify SimpleForm to use ⎕NEW HRUtils.HttpRequest and wait for an updated Dyalog installation image.
I hope this helps!
/Brian
-
Brian|Dyalog - Posts: 120
- Joined: Thu Nov 26, 2009 4:02 pm
- Location: West Henrietta, NY
Re: Update of the SimpleForm example
Many thanks Brian, it's working now.
-
PGilbert - Posts: 440
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group