English 中文(简体)
SCALAlift - AJAX form multi Value
原标题:SCALA Lift - AJAX form multiple values

I have the following form:

<form class="lift:form.ajax">
    <input type="hidden" class="lift:StreamIn" id="path" value="PATH" />
    <input type="submit" value="" />
</form>

哪些是:

object StreamIn {

    def render = SHtml.onSubmit(path => {

        StreamServer ! path

    })

}

case class StreamItem(user: String, path: String, level: String, room: String)

object StreamServer extends LiftActor with ListenerManager {

    private var streams: List[StreamItem] = Nil

    def createUpdate = streams

    override def lowPriority = {

        case stream: String if stream.length > 0 =>

            streams :+= StreamItem("James", stream, "_1", "demo-room");
            updateListeners()

    }

}

我所期待的是,一种方式是,把多种价值观带给精炼者,并投入不止一个。

因此,将不采用静态扼制数值“James”、“_1”和“demo-room”的形式。

事先得到任何帮助,非常赞赏:

最佳回答

Is it ok to have several input fields on your ajax form? If so, how about:

<form class="lift:form.ajax">
  <div class="lift:StreamIn">
    <input type="text" name="path" />
    <input type="text" name="user" />
    <input type="text" name="level" />
    <input type="text" name="room" />
    <input type="hidden" name="hidden" />
  </div>
</form>

<>上>

object StreamIn {
  case class StreamItem(user: String, path: String, level: String, room: String)
  def render = {
    var path= ""
    var user= ""
    var level= ""
    var room= ""
      def process(): JsCmd= {
        val message= StreamItem(user, path, level, room)
        StreamServer ! message
      }

    "name=path" #> SHtml.onSubmit(path= _ ) &
    "name=user" #> SHtml.onSubmit(user= _ ) &
    "name=level" #> SHtml.onSubmit(level= _ ) &
    "name=room" #> SHtml.onSubmit(room= _) &
    "name=hidden" #>  SHtml.hidden(process)

  }
}

• 改变低等级:

override def lowPriority = {
  case StreamItem(userIn, pathIn, levelIn, roomIn) => {
    streams :+= StreamItem(userIn, pathIn, levelIn, roomIn);
    updateListeners()
  }

}

我略去了几句话},但我希望大家能看到这一想法,如果你能够提供,你可能就能够利用请求Var进入某些领域,如房间和面积。

http://simply.liftweb.net/index-4.8.html#toc-section-4.8“rel=“nofollow” 简略提要

希望会有助于

问题回答

暂无回答




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签