13 Mar 2012 cdent   » (Master)


Tiddler Title:

<script label="Create Tiddler" title="Create Tiddler from Inside Javascript" key="X">

Create Tiddler based on User Input to HTML Form

var myTitle;
myTitle = document.getElementById("theTitle").value;
myTitle = myTitle.trim();

if (myTitle == || myTitle == 'none')
alert('Title is Empty\nMust Enter Title to Continue');
alert('Tiddler will be Titled "'+myTitle+'"');

myText = "!"+myTitle+"\nHere is some content";

var tid = new Tiddler(myTitle);
tid.title = myTitle;
tid.text = myText;
tid.tags = new Array("tag1 tag2 tag3");
tid.creator = config.extensions.tiddlyweb.username;
tid.fields = merge({}, config.defaultCustomFields)
tid = store.saveTiddler(tid);
autoSaveChanges(null, [tid]);


Trim Function - Removes Leading & Trailing Spaces

String.prototype.trim = function() {
return this.replace(/(^\s*)|(\s*$)/g,"")


Syndicated 2012-03-13 10:42:35 (Updated 2012-03-13 10:47:36) from cdent

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!