From 1db28c6fb029a33efd815ee851ccb058f00808d8 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Thu, 3 Nov 2011 16:53:29 +0000 Subject: [PATCH] add placeholder option to Ox.Editable --- source/Ox.UI/js/Form/Ox.Editable.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/Ox.UI/js/Form/Ox.Editable.js b/source/Ox.UI/js/Form/Ox.Editable.js index 5259be67..70d903f7 100644 --- a/source/Ox.UI/js/Form/Ox.Editable.js +++ b/source/Ox.UI/js/Form/Ox.Editable.js @@ -180,9 +180,13 @@ Ox.Editable = function(options, self) { } function formatValue() { - return self.options.format - ? self.options.format(self.options.value) - : self.options.value + var value = self.options.value; + if (self.options.value === '' && self.options.placeholder) { + value = self.options.placeholder; + } else if (self.options.format) { + value = self.options.format(self.options.value) + } + return value; } function submit() {