Skip to content

Commit 16079d8

Browse files
author
Stephen Tu
committed
used ajaxForm for thought stream form now
1 parent 107f12d commit 16079d8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/scala/edu/berkeley/cs/scadr/snippet/ThoughtStream.scala

+6-3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class ThoughtStream {
5252
}
5353

5454
def ajaxThink(xhtml: Group): NodeSeq = {
55+
var thought = ""
5556
def process(s: String): JsCmd = {
5657
processThought(s) match {
5758
case Some(t) =>
@@ -60,9 +61,11 @@ class ThoughtStream {
6061
Alert("Unable to save message - server error")
6162
}
6263
}
63-
bind("e", xhtml,
64-
"thought" -> SHtml.text("", (t: String) => (), "id" -> "thought"),
65-
"submit" -> <button onclick={SHtml.ajaxCall(ValById("thought"), process _)._2}>Think</button>)
64+
SHtml.ajaxForm(
65+
bind("e", xhtml,
66+
"thought" -> SHtml.text("", (t: String) => thought = t, "id" -> "thought"),
67+
"submit" -> SHtml.submit("submit", () => { })) ++
68+
SHtml.hidden(() => { process(thought) }))
6669
}
6770

6871
def think(xhtml: NodeSeq): NodeSeq = {

0 commit comments

Comments
 (0)