#1 Re: mORMot 1 » Turn MVC View Caching in DEBUG mode off » 2020-12-29 20:48:32

pvn0 wrote:

to disable cache for the Default view you could try this

TMVCRunWithViews(fMainRunner).SetCache('Default',cacheNone)

if you have other views cached then you have to do the same for those.

What class are you inheriting from anyway for your MVC application?

From IMVCApplication.

So I need set SetCache for all view, there is not a way to set cacheNone to all view at same time, right?

#2 Re: mORMot 1 » Turn MVC View Caching in DEBUG mode off » 2020-12-15 18:19:23

Any solution without edit the original code? Just for debug.

#3 Re: mORMot 1 » Problem mORMotMVC with Delphi 10.4 » 2020-07-15 20:45:15

OK. I can confirm there is a problem with demo 30 and last version of framework.

With version 1.18.6078 the demo work without problem.
With version 1.18.6089 the demo crash after run.

Test on Delphi 10.4 in release mode and win32.

#4 Re: mORMot 1 » Problem mORMotMVC with Delphi 10.4 » 2020-07-14 16:43:21

I have compiled and ran demo 30 (win32) then use browser to browser client pages.
I have only mORMot Framework e VerySimple.Lua installed.
mORMot Framework version used: 1.18.6078

Also my application is win32 and work but I tested it only in debug mode until now.

#5 Re: mORMot 1 » Problem mORMotMVC with Delphi 10.4 » 2020-07-14 13:52:00

I tried to compile demo 30 both in debug mode and release mode with Delphi 10.4 and it works without error.
Also my software (based on MVC) works.
I'm not sure of framework version used but one of last build. (is there a way to know the build?)

#6 Re: mORMot 1 » Turn MVC View Caching in DEBUG mode off » 2020-05-21 15:04:57

Isn't there an easier way to disable cache?

I don't like modifying the original code but when debugging the cache is annoying.

#7 Re: mORMot 1 » Cannot compile last timeline version » 2020-05-19 21:21:59

mpv wrote:

@array81 - wokring SyNode version is currently in feature/synodeCleanup brunch. I try to keep it in sync with master..

I have try to use https://github.com/synopse/mORMot/tree/ … odeCleanup but this is the result:

[dcc32 Error] SpiderMonkey.pas(600): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(601): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(602): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(603): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(604): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(605): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(606): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(607): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(609): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(2026): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2026): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2028): E2070 Unknown directive: 'JS_DisableExtraThreads'
[dcc32 Error] SpiderMonkey.pas(2029): E2004 Identifier redeclared: 'external'
[dcc32 Error] SpiderMonkey.pas(2029): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2043): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2044): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2044): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2047): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2048): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2048): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2051): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2052): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2052): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2055): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2056): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2056): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2060): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2061): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2061): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2065): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2066): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2066): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2069): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2072): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2072): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2074): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2075): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2075): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Fatal Error] SpiderMonkey.pas(2075): E2226 Compilation terminated; too many errors

#8 mORMot 1 » Cannot compile last timeline version » 2020-05-16 12:42:43

array81
Replies: 10

After a long time I have try to upgrade my Synopse with last timeline version (2020-05-14 16:06:21).

On Delphi 10.3 I get these errors:

[dcc32 Error] SyNodeRemoteDebugger.pas(224): E2003 Undeclared identifier: 'SafePush'
[dcc32 Error] SyNodeRemoteDebugger.pas(525): E2003 Undeclared identifier: 'SafePush'
[dcc32 Error] SyNodeRemoteDebugger.pas(602): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(603): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(620): E2010 Incompatible types: 'TRawUTF8ListLocked' and 'TRawUTF8List'
[dcc32 Error] SyNodeRemoteDebugger.pas(621): E2010 Incompatible types: 'TRawUTF8ListLocked' and 'TRawUTF8List'
[dcc32 Error] SyNodeRemoteDebugger.pas(683): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(684): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(777): E2003 Undeclared identifier: 'SafePop'
[dcc32 Error] SyNodeRemoteDebugger.pas(777): E2015 Operator not applicable to this operand type
[dcc32 Error] SyNodeRemoteDebugger.pas(777): E2015 Operator not applicable to this operand type
[dcc32 Fatal Error] SyNode.pas(1319): F2063 Could not compile used unit 'SyNodeRemoteDebugger.pas'

#9 Re: SyNode » Is there someone out there using this? » 2020-01-24 15:55:41

I use it on my project to do it: delphi application call js file with same variables as parameters, the JS code is executed then pass result as variables to delphi application. Yes I don't have found documentation but there is a working example. I used that to understand how to do it

#10 mORMot 1 » MCV call view with parameters without use URI » 2019-12-12 23:39:17

array81
Replies: 0

About sample "30 - MVC Server", on ArticleMatch is there a way to call "Default" without use URI to send "match" parameter?
GotoView redirect to a view and send parameters by URI. I nees redirect to view and send parameters but without show them on URL address. I want add them directly on "scope". Is this possible?

#11 Re: mORMot 1 » Change view path on fly for MVC Web Application » 2019-09-13 17:18:22

This is almost perfect, I have only a problem: pass the data from function to method.

The user call NewInvoice method, so he can use a form the set all data of new invoice.
There are 2 buttons, with the first button he can call SaveInvoice function and save the new invoice with all data from html form. With second button he can call InvoicePreview function to have a preview ON AN OTHER browser tab.
With you code InvoicePreview function can call ShowInvoicePreview method and then show custom invoice but how can pass html data sent with InvoicePreview function to ShowInvoicePreview method?

I hope I explained myself.

#12 Re: mORMot 1 » Change view path on fly for MVC Web Application » 2019-09-09 17:23:06

With TMVCViewsMustache I can customize folder templates by template filename.
But I can customize filename view from command of the web application?

I have a command like "ShowInvoicePreview" to create an invoice preview, however the user can choose between more invoice template (I use mustache and "view style" saved on custom path) besides user can create more of them. So the "ShowInvoicePreview" should read from db the invoice template for current user and use the right view (saved on custom path).

By default mORMot use a view with the same name of command, is there a way to customize the view name from code?

#13 SyNode » Bug in jsval? » 2019-08-14 09:57:55

array81
Replies: 1

I think jsval.asDouble have some problem, if I set a double it works:

function test(aData: double): double; <-- aData = 200.45
var
  myvar: jsval;
begin
  myvar.asDouble := aData;
  Result myvar.asDouble  <-- return 200.45
end;

but if I set a integer it doesn't work:

function test(aData: double): double; <-- aData = 200
var
  myvar: jsval;
begin
  myvar.asDouble := aData;
  Result myvar.asDouble  <-- return NAN
end;

I know that I can use jsval.asInteger but in my case I don't know if entry variable is a integer or double (generally it is double but in some case an integer). Anyhow I think asDouble should handle this.

#14 Re: mORMot 1 » Change view path on fly for MVC Web Application » 2019-02-07 11:55:42

Chaa wrote:

Class TMVCViewsMustache has virtual methods FindTemplates, GetTemplate and GetStaticFile.
So you can customize process of reading templates and static files.

For example, see Virtual methods for loading templates in MVC Web App.

If I understand your post, in this way I need "handle" ALL views and not only a part of them, right?
In my case I should handle (I think by filename) both "template" views and "basic" views, right?

#15 mORMot 1 » Change view path on fly for MVC Web Application » 2019-02-06 14:17:41

array81
Replies: 5

On my MVC Web Application I have a folder structure similar to the example 30:

ROOT
 |-views
    |-.static

Now I need add a billing system on my application. I don't want to create a rigid system.
My idea is create a "template system", the user can be edit (and if he want add) 2 files for any bill type: un javascript file for "logical" (I use spidermonkey for it) and a html file for "model" to use with mustache.
I'd like create a folder on ROOT with these files, in alternative in fact the user should change "views" folder with the risk of doing damage:

ROOT
 |-views
    |-.static
 |-templates
    |-.static

So I should customize the VIEW path and VIEW filename for a specific command, for example when the user call "CreateInvoice" command the application should check invoice templete used by user on database and then use the specific VIEW from "templates" folder.

Is this is possible? How?

#16 SyNode » Javascript Engine Documentation » 2019-01-26 23:44:10

array81
Replies: 0

Is the Javascript Engine section on official (chapter 22) is upgrade?
Are there 2 different project about Javascript Engine? I see a documentation that is consistent with demos on SQLite3 folder and a SyNode without documentation (I think) and with examples not very effective.
Is the project on official documentation still maintained? Beacuse I see an old SpyderMoney version.
Can you explain me how convert example 22 to new project because without documentation I have some problem about it?

#17 Re: SyNode » Variable sharing between Delphi and Javascript » 2018-12-12 18:25:39

mpv wrote:

You are right. This will be a good task for me on Christmas smile

If possible can you convert the sample 22 (based old spidermonkey implementation) because I have some problem to convert it to use it with the new implementation. Thanks.

#18 Re: SyNode » Variable sharing between Delphi and Javascript » 2018-12-10 17:00:16

mpv wrote:

So to pass a "variable" into JS either pass it as a parameter to function or set as property of global object (or some member of global object). To get variable value back get a value of global object property with the same name as your variable (or create a function in JS what return your value)

I think I understand.
Please do some cleaning on <mORMot_root>\SyNode\Samples folder when you have time smile

#19 Re: SyNode » Variable sharing between Delphi and Javascript » 2018-12-10 16:42:30

edwinsn wrote:

The latest is the wrapper for SpiderMonkey52, you should look at <mORMot_root>\SyNode\Samples

There is a lot of confusion in this folder.
The examples are not very clear.

#20 SyNode » Variable sharing between Delphi and Javascript » 2018-12-10 14:23:14

array81
Replies: 6

I have see the sample 22 about use of javscript with Mormot and this is clear enough.
However on my case I'd like to do the:
1. set from Delphi some Javascript variables value (float and integer);
2. run Javscript code;
3. get Javascrit variables value to use they on Delphi code.

On documentation I don't see nothing about variables transition.

What is the best approach for my goal?

regards

#21 Re: mORMot 1 » Access to MVC application from another device » 2018-11-28 09:14:34

mpv wrote:

The latest info from my DevOps - for external access to Windows 10 HTTP.SYS  based server initial registration (urlacl entry) should be a host name, not a + or *. So you should replace "+" to the host name. Hope it help

I have replace symbol with IP address of my server PC but nothing change. Works only in local. I cannot access from external (LAN) PC/smartphone.

This is crazy thing. Am I the only one to have this problem?

#22 Re: mORMot 1 » Access to MVC application from another device » 2018-11-28 07:28:07

mpv wrote:

@Sapiem write something similar it this topic - https://synopse.info/forum/viewtopic.php?id=4656

I think the problem is somewhere in your Windows settings. Yes, windows sometimes is painful.

Today I did some tests on a new PC (just bought so with Windows 10 clear installation), the result is the same. The "client side" is accessible from PC (when I run the application as administrator the first time) but not from other PCs connect by LAN (both cable and wifi).
useBidirSocket works but not useHttpApiRegisteringURI.

Any suggestions?

#23 mORMot 1 » Mustache sections and array of items » 2018-11-02 23:39:52

array81
Replies: 1

By mustache template I have fill a javascript array.
Something like this:

    var items= [
	  {{#item}}
          { "ID": {{ID}}, "Title": "{{Title}}", "Kind": {{Kind}}, "Code": "{{Code}}", "Date": "{{Date}}" },
	  {{/item}}
    ];

My problem is last item, this item in fact don't need of last comma.
Is there a way to avoid it?

#24 Re: mORMot 1 » Custom content from a MVC Application without a template file » 2018-10-21 16:52:55

In this case is there a way to know if a user is logged?

I'd like avoid that "Version" return the result if user is not logged in MVC application.

Is it possible? How?

#25 mORMot 1 » Browser server folders from client on MVC application » 2018-10-21 07:35:21

array81
Replies: 2

On my MVC application the user on client (so as webpage) must be select a folder on server. The user must browser the server folders from a specific path not from root. Then select a folder and pur it on a input form.

Any suggestion about it?

#26 Re: mORMot 1 » Access to MVC application from another device » 2018-10-21 07:27:16

mpv wrote:

@Sapiem write something similar it this topic - https://synopse.info/forum/viewtopic.php?id=4656

I think the problem is somewhere in your Windows settings. Yes, windows sometimes is painful.

Good. It will be fun find the problemi.

#27 Re: mORMot 1 » Access to MVC application from another device » 2018-10-16 21:07:53

mpv wrote:

So the problem is in HTTP.SYS registration table (useBidirSocket use plain socket server). Most of all you have some "old" entries in http.sys registration table (call `netsh http show urlacl` as admin to see all entries and remove all entries related to port 8092 in your case)

So I have:
1. Show allmy "old" entries with "netsh http show urlacl" as admin;
2. Delete all entries about port 8092 with "netsh http delete urlacl url=http://+:8092/", "netsh http delete urlacl url=http://+:8092/...", ...
3. Replace "useBidirSocket" with "useHttpApiRegisteringURI";
4. Run my application as admin the first time.

In this way I get the same result. I cannot access to my MVC application from external device.

Now the entries are correct.

#28 Re: mORMot 1 » Access to MVC application from another device » 2018-10-16 06:31:51

mpv wrote:

You can try with plain socket server by defining ONLYUSEHTTPSOCKET in  Synopse.inc line 604 to be sure this is not a HTTP.SYS related problem

In this moment I have solve the problem using "useBidirSocket" instead of "useHttpApiRegisteringURI".
This works though I get some error message on debug.

#29 mORMot 1 » Access to MVC application from another device » 2018-10-12 13:44:09

array81
Replies: 12

About example 30.
If I visit localhost:8092 from PC where I run the server application I see the client side on browser, but if I try to visit 192.168.xxx.xxx:8092 (192.168.xxx.xxx is ip of my server on my LAN) from other device (I have try from android phone with chrome) I cannot establish the connection. I just have set the firewall.
Do I need anything else?

#30 mORMot 1 » Know previous view name of MVC application » 2018-10-09 06:43:59

array81
Replies: 1

We hypothesize that I have 3 views (A, B and C) on MVC application.
From A and B I can call C view. Can I know who have call C?

TSQLRestServerURIContext does not seem have this property.
URIAfterRoot get me C as current view before show it.

Do I have to implement a system or the framework just have it?

#31 mORMot 1 » Join more table and get JSON code on MVC application » 2018-10-04 17:38:16

array81
Replies: 1

On MVC application i have a model like this:

TSQLTag = class(TSQLSomeone)
private

published

end;

TSQLUser = class(TSQLSomeone)
private

published

end;

TSQLContact = class(TSQLSomeone)
private

published

end;

TSQLProject = class(TSQLRecordTimeStamped)
private
  fUsers: TIntegerDynArray;
  fContacts: TIntegerDynArray; 
  fTags: TIntegerDynArray; 
...
published
  property Users: TIntegerDynArray index 1 read fUsers write fUsers;
  property Contacts: TIntegerDynArray index 2 read fContacts write fContacts 
  property Tags: TIntegerDynArray index 3 read fTags write fTags
...
end;

I need extract all projects and get all users, contacts and tags for each project. So I'd like get a JSON code like this:

"projects": 
[
    {
    "ID": 1,
    "Title": "example",
    "Code": "12345",
    "Users":
    [
        {
        "LastName": "aaa"
        "FirstName": "bbb",
        },
        {
        "LastName": "ccc"
        "FirstName": "ddd",
        }
    ],
    "Contacts":
    [
        {
        "LastName": "eee"
        "FirstName": "fff",
        },
        {
        "LastName": "ggg"
        "FirstName": "hhh",
        }
    ],
    "Tags":
    [
        {
        "Name": "iii"
        },
        {
        "Name": "lll"
        }
    ]
    }
],

Is there a way to do this?

What is the best way?

#32 Re: mORMot 1 » Variable input parameters as array on MVCViewModel » 2018-09-25 10:49:56

Chaa wrote:

You can access raw input parameters

Thanks for you suggestion.

#33 Re: mORMot 1 » Variable input parameters as array on MVCViewModel » 2018-09-22 22:04:35

ab wrote:

This "multiple" tag is indeed not handled yet.

Is there an alternative way to handle multiple selection input of html form?
On my application should have many multiselection input.

#34 mORMot 1 » Variable input parameters as array on MVCViewModel » 2018-09-21 20:56:02

array81
Replies: 4

On my application I have a HTML form with select2:

<select class="form-control select2" id="Contacts" name="Contacts" multiple="multiple" data-placeholder="" style="width: 100%;" value="{{Project.Contacts}}">
 {{#Contacts}}
 <option value="{{{ID}}}" {{{Status}}}>{{{Ident}}}</option>
 {{/Contacts}}
</select>

The user can select more option so when the user submit the form I have a URI like this:

...&Contacts=10&Contacts=11...

How can I handle this on MVCViewModel?
I should have an array on MVCViewModel so I have define a variant and try with:

with _Safe(Contacts)^ do
for j := 0 to Count-1 do
  begin
	if VariantToInt64(Values[j], ido) then
	  project.DynArray('Contacts').Add(ido);
  end;

but NOT work.

I have the feeling that the framework with considering this possibility.
In fact I think it use only last value of Contacts variable (11 on my example).

Am I wrong?

Note I have also try to use "name="Contacts[]" on form.

#35 mORMot 1 » [85d38e604c] release and MVC Server form problem » 2018-09-20 16:28:13

array81
Replies: 1

If I upgrade my Synopse code to [85d38e604c] or up I get problem with form submit on my MVC Server application.
If there is one or more empty fields on form I get this error with submit:

{"ClassName":"EMVCException","Address":"0074DBC6 mORMotMVC.TMVCRendererAbstract.ExecuteCommand (1544) ","Message":"TMVCRendererFromViews.CommandRunMethod: IMyApplication.savecontact failed on BirthPlace:RawUTF8 [missing or invalid value]","context":"TMVCRendererFromViews.ExecuteCommand"}

If there is not empty fields all works. I think this depend on JsonDecode() but I don't know how fix it.

regards

#36 mORMot 1 » Edit variant array item » 2018-09-18 21:49:53

array81
Replies: 0

I have a model like this:

  TSQLArticle = class(TSQLContent)
  private
    ...
    fTags: TIntegerDynArray;
    ...
  public
    ...
  published
    ...
    property Tags: TIntegerDynArray index 1 read fTags write fTags;
    ...
  end;

  TSQLTag = class(TSQLRecord)
  private
    fIdent: RawUTF8;
    ...
  published
    property Ident: RawUTF8 index 80 read fIdent write fIdent;
    ...
  end;

Like on your demo 30.
When the user edit an article I need send to mustache templeate the list of all tags (for fill select2 input box) but also send selected tags for article.

If I use this code

tags := RestModel.RetrieveDocVariantArray(TSQLTag ,'','ID, ..., ....');

The JSON contains all tag data of all tags to fill select input box but there is not information about the tag is select or not (TSQLArticle.Tags properties).

Is there a fast way to add this information on all variant array items?

#37 Re: mORMot 1 » VariantToTIntegerDynArray function » 2018-08-30 13:01:09

ab wrote:

Using such an expression helper to query the DB is some kind of breaking of the whole Mustache concept... it should be done before apply the template, in the data context.

So I should extract contacts before and send them with project data as json, right?

#38 Re: mORMot 1 » VariantToTIntegerDynArray function » 2018-08-29 21:00:04

ab wrote:

Use a Mustache loop over the array.

Please check the context data as JSON, and read again the docs about Mustache.
You don't need helpers here, I'm quite sure!

I cannot use a Mustache loop.
On Mustache template there is a Select2 input box (https://select2.org/). I need fill it with all contacts of my DB then select only contacts assigned to project.
To do it I thought to pass all array to Expression Helpers then use it for: 1. extract all contacts name from DB, 2. create all HTML about Select2 "option" and flag as "selected" the contact by TSQLProject.Contacts value.
To do it I need use array value on Expression Helpers but I cannot understand how handle array from variant.

#39 Re: mORMot 1 » VariantToTIntegerDynArray function » 2018-08-28 22:26:48

ab wrote:

Isn't the TSQLRecord serialized as a JSON array of integers?

It should be.

I have this TSQLRecord:

  TSQLProject = class(TSQLRecordTimeStamped)
  private
    fTitle: RawUTF8;
    fContacts: TIntegerDynArray;
    ...
  published
    property Title: RawUTF8 index 120 read fTitle write fTitle;
    property Contacts: TIntegerDynArray index 1 read fContacts write fContacts;
    ...
  end;

  TSQLContact = class(TSQLSomeone)
  private
    fBirthDate: TDateTime;
    fBirthPlace: RawUTF8;
    ...
  public

  published
    property BirthDate: TDateTime read fBirthDate write fBirthDate;
    property BirthPlace: RawUTF8 index 50 read fBirthPlace write fBirthPlace;
    ...
  end;

Then I need plot a mustache template using the Project data but also some contacts data (the same project can have more contacts).
On my idea I pass project data to mustache template then use Expression Helpers with Contacts value (array of integers) to get contacts data.

Is this the right approach? How deserialize the Json array?

#40 mORMot 1 » VariantToTIntegerDynArray function » 2018-08-27 22:36:29

array81
Replies: 7

I have a TSQLRecord with a TIntegerDynArray field.
On mustache template a need call a custom Expression Helpers and use the TIntegerDynArray field as value, then on custom Expression Helpers I need extract the TIntegerDynArray value.

I cannot found a VariantToTIntegerDynArray function or something like this to use on custom Expression Helpers.

#41 mORMot 1 » Edit TSQLRecord structure before pass it to mustache template » 2018-03-23 22:58:41

array81
Replies: 1

On a MVC/MVVM Web application I have a TSQLRecord with a TDateTime record.
I need retrive the records of this table and send it to mustache template to fill a html form.
On html form I have 2 field, one field for date and one field for time, the use can edit these fields and then submit the new value to record them on database.

My problem TSQLRecord have a only proprerty TDateTime (for date and time) so I need split this before send it to mustache template.

How can I split the date and the time and add it to TSQLRecord before send it to mustache template?

#42 mORMot 1 » Right way to pass DateTime from HTML form on MVC/MVVM Web application » 2018-02-28 14:01:12

array81
Replies: 0

I have a HTML form with a date field. I need pass this date to Delphi procedure and save it DB as TDateTime (I have a TSQLRecord on my model with a TDateTime field).

What is the right way to pass this date from HTML to Delphi?
I have try to define a TDateTime parameter on Delphi procedure but I get and error from Delphi when submit the form. So I have try to define a RawUTF8 parameter on Delphi procedure this avoid the Delphi error but the date (converted by Iso8601ToDateTime) is not save on DB.

#43 mORMot 1 » Debug MVC/MVVM Web application » 2018-02-05 23:24:38

array81
Replies: 1

On MVC/MVVM Web applications development is there a way to know data sent to Mustache template?
I need see it for debug purpose.

#44 Re: mORMot 1 » Cookies and expire by date on web application » 2018-01-17 18:17:22

oz wrote:

You can specify your desired timeout in TMVCSessionWithCookies.Initialize(PRecordData,PRecordTypeInfo: pointer; SessionTimeOutMinutes: cardinal): integer;
Param: SessionTimeoutMinutes.

SessionTimeoutMinutes: "you can supply a time period, after which the session will expire - default is 1 hour" (from document) this is duration of the session.
After this time the session is close. So I cannot use for my use.

I would like my user to choose between session approach (more safe) and classic cookies approach.

#45 mORMot 1 » Cookies and expire by date on web application » 2018-01-16 14:49:53

array81
Replies: 2

On documentation I found information about cookies bit I found only expire by session. Is there a way to implement expire by date? My login form have a checkbox "remember me".
If user check it the browser shuold remember login for 10 days or until he doens't use logout button. In alternative cookies should work by session (until userver is working).

I know this method is noto safe by I'd like that user can choose it.

#46 mORMot 1 » Force use to login on MVC/MVVM Web application » 2018-01-13 08:30:05

array81
Replies: 1

I'm trying to implement the Controller of MVC/MVVM Web application (MVCViewModel) as indicated on paragraph 19.2 of documentation but I have a problem.
The Default method is always accessible to the user.

In my case I'd like to force the use to login so I want check CurrentSession to check cookies status and show login page if the user has not logged in. In alternative, if the user is logged he will see the INDEX page of Web applications (this can be Default or other view).

My problem is: I cannot avoid to use Defualt method as main page of my application but I cannot understand how how can redirect the user on login page if CurrentSession  test is to passed.

I have to use GotoView method? This method ask my a TMVCAction.

#47 mORMot 1 » [2edda8e3fb] compile error » 2017-12-29 23:13:03

array81
Replies: 1

When I try to compile "30 - MVC Server" example I get this error: "[dcc32 Error] SynCommons.pas(57694): E2003 Undeclared identifier: 'fCompare'".

#48 Re: mORMot 1 » Search engine » 2017-04-01 13:30:12

I have a problem with TSQLRecordFTS3.
I need change my TSQLResources ans so my TSQLFTSResources definition (add and change field) but I get an error about "virtual table alter".

Is there a way to change my fields using TSQLRecordFTS3?

#49 Re: mORMot 1 » Search engine » 2016-08-09 10:23:39

Can you tell more about custom tokenizer?

Is it possible create custom tokenizer for any language? How?

#50 Re: mORMot 1 » Search engine » 2016-08-09 07:42:12

The Stemming working well also with no-english language? In documentation I can read "is the way the english text is parsed for creating the word index from raw text".

Board footer

Powered by FluxBB