[pmwiki-devel] customised input with $InputTags

Hans design5 at softflow.co.uk
Fri Dec 15 03:43:26 CST 2006

Thursday, December 14, 2006, 10:52:22 PM, Hans wrote:

> I created a new input text form which has javascript onfocus and
> onblur added: focus on the box, and the value will disappear.change
> focus to somewhere else, and the original value will reappear.

> php for this:

> $InputTags['text'][':html'] = "<input type='text' \$InputFormArgs  
>     onfocus=\"prevalue=this.value; this.value=''\"
> onblur=\"this.value=prevalue\" />";

> Now if I put this into config.php it will apply to all textline input
> boxes. But I rather restrict it only to some and not to others.
> How can I do that? Create two types of input text forms?

I could not find a method to use $InputTags in order too create the
desired two types of text box. But I managed a way to use javascript
and the name of input text. Here is the code:

$InputTags['text'][':html'] = "<input type='text' \$InputFormArgs
    onfocus=\"pv=this.value; if(this.name.indexOf('-clear')!=-1) this.value=''\" onblur=\"this.value=pv\" />";

An input textbox defined like this will clear the value in it when
clicked, if the name contains '-clear', otherwise it will not clear the

so (:input text box1-clear "Some Value":) will clear when
clicked, but (:input text box2 "Another Value":) will not
clear the value from the box when clicked.

Such redefined input text box may prove quite useful I think.


More information about the pmwiki-devel mailing list