开发者

How do I make a simple button in liftweb

开发者 https://www.devze.com 2023-01-30 14:30 出处:网络
I am completely new to webprogramming, I never made anything that goes in that direction. But for some reason I now want to know how it works. Since I am familar with scala i tried the lift framework.

I am completely new to webprogramming, I never made anything that goes in that direction. But for some reason I now want to know how it works. Since I am familar with scala i tried the lift framework.

I want to create a Button that does nothing more than notifying the server that the button was pressed.

At the moment my button is:

<input type="submit" value="chat"/>
开发者_高级运维

and the notification of the server works with

SHtml.hidden( makeRequest _ )

But somhow this feels very stupid. It works, and it looks like how I want it to look like. But creating a hidden form element, just because i cant bind a function to a button element feels so ... yea I can't find a better word than stupid.

SHtml.submitButton(makeRequest _) 

Is also very strange. I can't give a name to it (why?) and the function is not called when pressed (why?)


Have you wrapped the XML/HTML template with a form attribute? Apart from that, SHtml.submit("button name", makeRequest) should usually work.

Have a look at Exploring Lift.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号