Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling client function from server in on.* raises exception #66

Closed
qwe2 opened this issue Dec 18, 2015 · 0 comments
Closed

Calling client function from server in on.* raises exception #66

qwe2 opened this issue Dec 18, 2015 · 0 comments

Comments

@qwe2
Copy link
Member

qwe2 commented Dec 18, 2015

Calling any of the on.* methods with a quotation from the server-side causes the following exception:

System.TypeInitializationException: 
The type initializer for '.$Attr' threw an exception. ---> WebSharper.JavaScript.ClientSideOnly: This function is intended for client-side use only. 
at WebSharper.UI.Next.Client.Attr.OnAfterRender(FSharpFunc`2 callback) 
at .$Attr..cctor() --- End of inner exception stack trace --- 
at .$Attr.mk@109(FSharpList`1 acc, Address a) 
at [email protected](Info meta) 
at WebSharper.UI.Next.Attr.Write(Info meta, HtmlTextWriter w, Boolean removeDataHole) 
at [email protected](Attr a) 
at Microsoft.FSharp.Primitives.Basics.List.iter[T](FSharpFunc`2 f, FSharpList`1 x) 
at WebSharper.UI.Next.Elt.Write(Info meta, HtmlTextWriter w, FSharpOption`1 res) 
at [email protected](HtmlTextWriter tw) 
at [email protected](FSharpOption`1 doctype, FSharpOption`1 title, FSharpFunc`2 writeHead, FSharpFunc`2 writeBody, HtmlTextWriter writer) 
at [email protected](Stream stream) 
at [email protected](Task`1 obj)

This is caused by Attr.ValidateForm, which contains client-side functionality, being a top-level binding instead of a function so it gets called when the module is referenced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants