On Dec 3, 3:46 pm, skye riquelme <[email protected]> wrote: > I have a short bit of simple code that lets me create a new > tiddler.... > <html><nowiki><form> ... > <input type="submit" value="Criar-la" onclick=' > var title = this.form.slide.value; ... > story.displayTiddler(null, title); > '></form></html> > > I have used this type of form before and everything works fine. In > fact this code also works...in that it does create the new > tiddler.....and then RELOADs the page....which both annoying and > totally confusing as to why. Can anyone suggest a cause for this > behaviour. I note that after the refresh the url reads like - > file:///......../Dropbox/directory/Page.html?title=r&text=r&tags=r&fields=r&who=r > ..... where these values obviously came from the new tiddler.......
The problem is that the <form> is being *submitted* and has action="..." defined, so it defaults to loading the current page again, with the form fields packed into the URL. Two ways to fix this (both really easy!): 1) Change type="submit" to type="button" (the 'onclick' handler does all the work, so you don't need form to do any additional 'submit' handling. and/or 2) add "return false;" to the end of the onclick handler. If the onclick handler returns false, the submit handler is bypassed by the browser. that should do it.... enjoy, -e -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.

