Default value for TextInput ?

View: New views
3 Messages — Rating Filter:   Alert me  

Default value for TextInput ?

by Apsy-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi List,

I would like to have something like that :
http://www.electrictoolbox.com/jquery-change-default-value-on-focus/

A default value for my form textboxes. I would like to have this behavior but without broke the form validation etc...

Does someone has already wrote a plugin like that ?!

Thanks for any help,

Regards

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: Default value for TextInput ?

by Apsy-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nobody can help me ? It seems to be simple to implement, but requires a knowledge in dojotoolkit.
I think, we should add a new attribute called "defaultValue" in order to do this.

What do you think about ?!

Thanks,

Le 30/06/2009 12:36, Apsy a écrit :
Hi List,

I would like to have something like that :
http://www.electrictoolbox.com/jquery-change-default-value-on-focus/

A default value for my form textboxes. I would like to have this behavior but without broke the form validation etc...

Does someone has already wrote a plugin like that ?!

Thanks for any help,

Regards


_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: Default value for TextInput ?

by Cedric Hurst :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Apsy,

You could try something like the following:

// execute the following method when the page finishes loading
dojo.addOnLoad({
   // connect the following method to the onChange event on the myFormField DOM Node
   dojo.connect(dojo.byId('myFormField'), 'onfocus', {
     // find the dijit object associated with myFormField (the INPUT domNode must have a dojoType attribute)
     var myFormFieldWidget = dijit.byId('myFormField');
      // if the dijit object is found and its value is blank, set its value to the default
      if(myFormFieldWidget && !myFormFieldWidget.getValue())
        dijit.byId('myFormField').setValue('my default value');
   });
})

Apsy-2 wrote:
Nobody can help me ? It seems to be simple to implement, but requires a
knowledge in dojotoolkit.
I think, we should add a new attribute called "defaultValue" in order to
do this.

What do you think about ?!

Thanks,

Le 30/06/2009 12:36, Apsy a écrit :
> Hi List,
>
> I would like to have something like that :
> http://www.electrictoolbox.com/jquery-change-default-value-on-focus/
>
> A default value for my form textboxes. I would like to have this
> behavior but without broke the form validation etc...
>
> Does someone has already wrote a plugin like that ?!
>
> Thanks for any help,
>
> Regards


_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest