Still no change. How about the preventing page refreshing
On May 5, 2017 10:06, "Kiran Subbaraman" <[email protected]> wrote:
> The `{{=form.custom.end}}` has to be after the submit button.
> http://web2py.com/books/default/chapter/29/07/forms-
> and-validators#Custom-forms
>
> ________________________________________
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On Fri, 05-05-2017 11:15 AM, Maurice Waka wrote:
>
> I have a web2py app, with two problems:
>
> 1. I can submit the customized form with pressing 'Enter' but when
> clicking the button, I get an error.
>
> 2. when pressing 'Enter', the form is submitted but the page is refreshed
> immediately. How can i stop that?
>
> Here is the code; This does not work
>
> <div class="message_input_wrapper">
> {{=form.custom.begin}}
> <input name="body" class="message_input" placeholder="Type your message
> here..."/>
> {{=form.custom.end}} </div><button type="submit"
> class="send_message">Send</button>
>
> This does not work either:
>
> <div class="message_input_wrapper">
> {{=form.custom.begin}}
> <input name="body" class="message_input" placeholder="Type your message
> here..."/>
> {{=form.custom.end}}
> <button type="submit" class="send_message">Send</button>
> </div>
>
> This is the js code:
>
> (function () {
> var Message;Message = function (arg) {
> this.text = arg.text, this.message_side = arg.message_side;
> this.draw = function (_this) {
> return function () {
> var $message;
> $message = $($('.message_template').clone().html());
>
> $message.addClass(_this.message_side).find('.text').html(_this.text);
> $('.messages').append($message);
> return setTimeout(function () {
> return $message.addClass('appeared');
> }, 0);
> };
> }(this);
> return this;};
> $(function () {
> var getMessageText, message_side, sendMessage;
> message_side = 'right';
> getMessageText = function () {
> var $message_input;
> $message_input = $('.message_input');
> return $message_input.val();
> };
> sendMessage = function (text) {
> var $messages, message;
> if (text.trim() === '') {
> return;
> }
> $('.message_input').val('');
> $messages = $('.messages');
> message_side = message_side === 'left' ? 'right' : 'left';
> message = new Message({
> text: text,
> message_side: message_side
> });
> message.draw();
> return $messages.animate({ scrollTop: $messages.prop('scrollHeight')
> }, 300);
> };
> $('.send_message').click(function (e) {
> return sendMessage(getMessageText());
> });
> $('.message_input').keyup(function (e) {
> if (e.which === 13) {
> return sendMessage(getMessageText());
> }
> });
>
>
>
> --
> 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.
>
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/oEjq7ACIqwI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
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.