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

Comments

Projects
None yet
2 participants
@qwe2
Contributor

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 .$Attr.func@103.Invoke(Info meta) 
at WebSharper.UI.Next.Attr.Write(Info meta, HtmlTextWriter w, Boolean removeDataHole) 
at .$Doc.Write@131-2.Invoke(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 WebSharper.Sitelets.Content.renderBody@164.Invoke(HtmlTextWriter tw) 
at .$Page.get_Default@43.Invoke(FSharpOption`1 doctype, FSharpOption`1 title, FSharpFunc`2 writeHead, FSharpFunc`2 writeBody, HtmlTextWriter writer) 
at WebSharper.Sitelets.Content.writeBody@157.Invoke(Stream stream) 
at WebSharper.Owin.Internal.W2O.WriteResponse@164.Invoke(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