Receiving return responses from code inside a html form

32 views
Skip to first unread message

skye riquelme

unread,
Sep 22, 2012, 6:20:56 PM9/22/12
to tiddl...@googlegroups.com
Hi All

Trying to understand more about javascript in TiddlyWiki and Html forms.

I gave a script that I use so people can login to a TW page (on-line). Now the script responds with various messages (using the javascript "return" command) and all works well when the script is in a seperate tiddler (obviously I have InlineJavascriptPlugin installed!!).

Now if I put that script inside a html form (which collects the users login details), the script is processed when the user hits the "button" (<input type=button...)... but the return messages are not seen! Why not?

And is there some way I can get to see those messages...as the user needs the confirmation ("logged in"..."login failed"...that the javascript is generating.)

Thanks in Advance
Skye

Eric Shulman

unread,
Sep 25, 2012, 1:11:58 PM9/25/12
to TiddlyWiki
> Now if I put that script inside a html form (which collects the users login
> details), the script is processed when the user hits the "button" (<input
> type=button...)... but the return messages are not seen! Why not?

The ability to render the return value from script is a feature of
InlineJavascriptPlugin and is not supported by embedded javascript
handlers invoked from standard HTML.

For your purposes, you might try using: alert('message text here').
This will display a browser-based popup message box with your text and
an OK button.

If you really need to render the output following the form, that is a
bit more tricky. You'll need to create a new containing element at
the end of the form, and then wikify() your message into it, like
this:

<input type="button" value="go" onclick="
var out=this.form.insertBefore(document.createElement('div'));
wikify('message text',out);
">

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
http://www.TiddlyTools.com/#Donations

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact
Reply all
Reply to author
Forward
0 new messages