You are not logged in.
Pages: 1
Hi,
Can someone provide me a sample case for adding a record from a web page?
<form method="PUT" action="http://localhost:8080/root/SampleRecord/"> ???
<input type="text" name="Name"/>
<input type="submit" value="Insert"/>
</form>
Thanks in advance
Offline
You can not use directly a form field to make a REST request!
Or the text should be written in JSON... not obvious.
For a web site using mORMot, take a look at sample 30, and documentation about MVC/web http://synopse.info/files/html/Synopse% … E_TITL_108
https://github.com/synopse/mORMot/tree/ … C%20Server
Online
Seems sample 30 uses interfaces based services, which are not available under Lazarus, or may be I failed in converting the project?
Even if I'm not a javascript developer, I don't mind if I have to use a few javascript to format/encode JSON.
What I want is a clear understanding of the format required for parameters tranmission.
For CRUD requests, and/or for method based services.
Offline
For Lazarus, you need to follow the instructions available in the doc, so that you generate the RTTI for interfaces.
See http://synopse.info/files/html/Synopse% … l#TITL_125
For JavaScript use, take a look at samples "18 - AJAX ExtJS Grid" and "19 - AJAX ExtJS FishFacts".
Another option is SMS in "29 - SmartMobileStudio Client".
The format is clearly stated in the doc.
http://synopse.info/files/html/Synopse% … #TITLE_223
http://synopse.info/files/html/Synopse% … ml#TITL_49
http://synopse.info/files/html/Synopse% … #TITLE_370
To see it live, the easiest is to put a breakpoint on the server executable in TSQLRestServer.URI().
You have the whole expected content in the Ctxt parameter.
Online
Thank you ab,
I got it about Lazarus, and I was already ok for the method's Request format.
Although I would definitely go the SmartMobile way, I was looking for a CRUD javascript sample for my understanding.
I saw through the code "TSQLRestServerURIContext.ExecuteORMWrite" that it is definitely possible.
Offline
Pages: 1