Am trying to pass a variable to the controller using the below code. It
works well with this code:
{{extend 'layout.html'}} {{=message}} <form> <div class="container"> <div
class="row"> <div class="col-md-offset-5 col-md-3 col-sm-6"> <div class=
"form-login"> <h4>{{=T("Welcome")}}</h4> <input type="text" id="UserName"
name="username" class="form-control input-sm chat-input" placeholder="{{=T("
username")}}" /> </br> <input type="text" id="UserPassword" name="password"
class="form-control input-sm chat-input" placeholder="{{=T("password")}}" />
</br> <div class="wrapper"> <span class="group-btn"> <button type="submit"
class="btn btn-primary btn-md">{{=T("login")}} <i class="fa fa-sign-in"></i
></button> </span> <span class="group-btn" style="float:right;"> <a
href="{{=URL("prov_login", "register")}}" class="btn btn-success
btn-md">{{=T("Register")}}</a> </span> </div> </div> </div> </div> </div> </
form>def my_views():
if request.vars>0:
out_message = request.vars
else:
out_message = "no post"
return dict(message=out_message)
However, when trying with the html/js code below, with the same controller
code, i don't get any message passed, instead its this: <Storage {}>
<form> <!-- container element for chat window --> <div id="chat"> <div
class="input-wrap"> <textarea type="text" id="UserName" name="username"
placeholder="{{=T("Ask me anything")}}"></textarea> </div> </div> </form>
interactionsSaveCommit = function() {
if (!localStorageAvailable) return
localStorage.setItem(interactionsLS,
JSON.stringify(interactionsHistory))
}
// set up the stage
container.classList.add("bubble-container")
var bubbleWrap = document.createElement("div")
bubbleWrap.className = "bubble-wrap"
container.appendChild(bubbleWrap)
// install user input textfield
this.typeInput = function(callbackFn) {
var inputWrap = document.createElement("div")
inputWrap.className = "input-wrap"
var inputText = document.getElementById("UserName");
inputWrap.appendChild(inputText)
inputText.addEventListener("keypress", function(e) {
// register user input
if (e.keyCode == 13) {
e.preventDefault()
typeof bubbleQueue !== false ?
clearTimeout(bubbleQueue) : false // allow user to interrupt the bot
var lastBubble =
document.querySelectorAll(".bubble.say")
lastBubble = lastBubble[lastBubble.length - 1]
lastBubble.classList.contains("reply") &&
!lastBubble.classList.contains("reply-freeform")
? lastBubble.classList.add("bubble-hidden")
: false
addBubble(
'<span class="bubble-button bubble-pick">' +
this.value + "</span>",
function() {},
"reply reply-freeform"
)
// callback
typeof callbackFn === "function"
? callbackFn({
input: this.value,
convo: _convo,
standingAnswer: standingAnswer
})
: false
this.value = ""
}
})
container.appendChild(inputWrap)
bubbleWrap.style.paddingBottom = "100px"
inputText.focus()
}
inputCallbackFn ? this.typeInput(inputCallbackFn) : false
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.