parent
927013a57a
commit
4e01fc1838
|
@ -24,13 +24,13 @@ exports.isDraft = function() {
|
||||||
return this.hasField("draft.of");
|
return this.hasField("draft.of");
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getFieldString = function(field) {
|
exports.getFieldString = function(field,defaultValue) {
|
||||||
var value = this.fields[field];
|
var value = this.fields[field];
|
||||||
// Check for a missing field
|
// Check for a missing field
|
||||||
if(value === undefined || value === null) {
|
if(value === undefined || value === null) {
|
||||||
return "";
|
return defaultValue || "";
|
||||||
}
|
}
|
||||||
// Parse the field with the associated module (if any)
|
// Stringify the field with the associated tiddler field module (if any)
|
||||||
var fieldModule = $tw.Tiddler.fieldModules[field];
|
var fieldModule = $tw.Tiddler.fieldModules[field];
|
||||||
if(fieldModule && fieldModule.stringify) {
|
if(fieldModule && fieldModule.stringify) {
|
||||||
return fieldModule.stringify.call(this,value);
|
return fieldModule.stringify.call(this,value);
|
||||||
|
|
|
@ -64,9 +64,9 @@ RadioWidget.prototype.getValue = function() {
|
||||||
tiddler = this.wiki.getTiddler(this.radioTitle);
|
tiddler = this.wiki.getTiddler(this.radioTitle);
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
if(this.radioIndex) {
|
if(this.radioIndex) {
|
||||||
value = this.wiki.extractTiddlerDataItem(this.radioTitle,this.radioIndex);
|
value = this.wiki.extractTiddlerDataItem(this.radioTitle,this.radioIndex,this.radioDefault);
|
||||||
} else {
|
} else {
|
||||||
value = tiddler.getFieldString(this.radioField);
|
value = tiddler.getFieldString(this.radioField,this.radioDefault);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
value = this.radioDefault;
|
value = this.radioDefault;
|
||||||
|
|
Loading…
Reference in New Issue