Re: Shadow text on input fields
I'm using Wicket to develop flexible, i18n-ed webapps where HTML and JS are second class citizens. At first your JS looks more compact, but on long term is a dead end. Stefan --- On Tue, 4/27/10, Robert Kimotho wrote: > From: Robert Kimotho > Subject: Re: Shadow text on input fields > To: users@wicket.apache.org > Date: Tuesday, April 27, 2010, 11:19 AM > have you tried:- > > onFocus="this.value=''" onMouseOver="window.status=' your > txt...';return true" onMouseOut="window.status='';return > true"> > > Kimotho, > > On 4/26/10, Stefan Jozsa > wrote: > > CSS: > > .inputHint { > > color: #66; > > } > > > > Java: > > add(new AttributeModifier("value", true, new > AbstractReadOnlyModel() > > { > > @Override > > public String getObject() { > > return > "yourHintText"; > > } > > })); > > add(new AttributeModifier("class", true, new > AbstractReadOnlyModel() > > { > > @Override > > public String getObject() { > > return > "inputHint"; > > } > > })); > > add(new AttributeModifier("onfocus", true, new > > AbstractReadOnlyModel() { > > @Override > > public String getObject() { > > return > "removeInputHint(this,'inputHint');"; > > } > > })); > > > > JS: > > removeInputHint = function(x, c) { > > x.setAttribute('value', ''); > > jQuery(x).removeClass(c); > > } > > > > Stefan > > > > > > > > > > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Shadow text on input fields
have you tried:- Kimotho, On 4/26/10, Stefan Jozsa wrote: > CSS: > .inputHint { > color: #66; > } > > Java: > add(new AttributeModifier("value", true, new AbstractReadOnlyModel() > { > @Override > public String getObject() { > return "yourHintText"; > } > })); > add(new AttributeModifier("class", true, new AbstractReadOnlyModel() > { > @Override > public String getObject() { > return "inputHint"; > } > })); > add(new AttributeModifier("onfocus", true, new > AbstractReadOnlyModel() { > @Override > public String getObject() { > return "removeInputHint(this,'inputHint');"; > } > })); > > JS: > removeInputHint = function(x, c) { > x.setAttribute('value', ''); > jQuery(x).removeClass(c); > } > > Stefan > > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Shadow text on input fields
CSS: .inputHint { color: #66; } Java: add(new AttributeModifier("value", true, new AbstractReadOnlyModel() { @Override public String getObject() { return "yourHintText"; } })); add(new AttributeModifier("class", true, new AbstractReadOnlyModel() { @Override public String getObject() { return "inputHint"; } })); add(new AttributeModifier("onfocus", true, new AbstractReadOnlyModel() { @Override public String getObject() { return "removeInputHint(this,'inputHint');"; } })); JS: removeInputHint = function(x, c) { x.setAttribute('value', ''); jQuery(x).removeClass(c); } Stefan - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Shadow text on input fields
If you don't want to use JavaScript, you can still try it with CSS and images, like HTML: CSS: input.name {background:url(name.png)} input.name:focus {background:none} But the problem is, if you leave the field the image returns. :) Witold Am Mon, 26 Apr 2010 14:28:57 +0300 schrieb Josh Kamau : > I wish we could have something like myTextField.setDefaultText("Type text > here"); > > On Mon, Apr 26, 2010 at 11:55 AM, Josh Kamau wrote: > > > Thanks Marjtin > > > > > > On Mon, Apr 26, 2010 at 11:27 AM, Martijn Dashorst < > > martijn.dasho...@gmail.com> wrote: > > > >> If you can get away with it, you can use HTML5's placeholder text: > >> > >> http://diveintohtml5.org/forms.html > >> > >> Martijn > >> > >> On Mon, Apr 26, 2010 at 9:19 AM, Josh Kamau > >> wrote: > >> > Hi guys; > >> > > >> > I would like to put some shadow text on the form input fields that > >> > disappears when one starts editing the field. The kind that appears on > >> > facebook fields. How do i do it. Most likely its not a wicket issue but > >> i > >> > really need assistance in this. Am not very good in javascript. > >> > > >> > Kind regards > >> > > >> > Josh > >> > > >> > >> > >> > >> -- > >> Become a Wicket expert, learn from the best: http://wicketinaction.com > >> Apache Wicket 1.4 increases type safety for web applications > >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.7 > >> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > >> For additional commands, e-mail: users-h...@wicket.apache.org > >> > >> > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Shadow text on input fields
>>Should Wicket test for HTML 5 support, and fall back to a Javascript "hack"? I would really be glad if it did this. Am working on a public facing web application and i cant be guaranteed that users' browsers will have HTML5 support. Kind regards. Josh On Mon, Apr 26, 2010 at 2:31 PM, Wilhelmsen Tor Iver wrote: > The problem is not the Wicket side of things, but the browser side. Should > Wicket test for HTML 5 support, and fall back to a Javascript "hack"? > > - Tor Iver > > > -Opprinnelig melding- > > Fra: Josh Kamau [mailto:joshnet2...@gmail.com] > > Sendt: 26. april 2010 13:29 > > Til: users@wicket.apache.org > > Emne: Re: Shadow text on input fields > > > > I wish we could have something like myTextField.setDefaultText("Type > > text > > here"); > > > > On Mon, Apr 26, 2010 at 11:55 AM, Josh Kamau > > wrote: > > > > > Thanks Marjtin > > > > > > > > > On Mon, Apr 26, 2010 at 11:27 AM, Martijn Dashorst < > > > martijn.dasho...@gmail.com> wrote: > > > > > >> If you can get away with it, you can use HTML5's placeholder text: > > >> > > >> http://diveintohtml5.org/forms.html > > >> > > >> Martijn > > >> > > >> On Mon, Apr 26, 2010 at 9:19 AM, Josh Kamau > > >> wrote: > > >> > Hi guys; > > >> > > > >> > I would like to put some shadow text on the form input fields that > > >> > disappears when one starts editing the field. The kind that > > appears on > > >> > facebook fields. How do i do it. Most likely its not a wicket > > issue but > > >> i > > >> > really need assistance in this. Am not very good in javascript. > > >> > > > >> > Kind regards > > >> > > > >> > Josh > > >> > > > >> > > >> > > >> > > >> -- > > >> Become a Wicket expert, learn from the best: > > http://wicketinaction.com > > >> Apache Wicket 1.4 increases type safety for web applications > > >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.7 > > >> > > >> > > - > > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > >> For additional commands, e-mail: users-h...@wicket.apache.org > > >> > > >> > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
SV: Shadow text on input fields
The problem is not the Wicket side of things, but the browser side. Should Wicket test for HTML 5 support, and fall back to a Javascript "hack"? - Tor Iver > -Opprinnelig melding- > Fra: Josh Kamau [mailto:joshnet2...@gmail.com] > Sendt: 26. april 2010 13:29 > Til: users@wicket.apache.org > Emne: Re: Shadow text on input fields > > I wish we could have something like myTextField.setDefaultText("Type > text > here"); > > On Mon, Apr 26, 2010 at 11:55 AM, Josh Kamau > wrote: > > > Thanks Marjtin > > > > > > On Mon, Apr 26, 2010 at 11:27 AM, Martijn Dashorst < > > martijn.dasho...@gmail.com> wrote: > > > >> If you can get away with it, you can use HTML5's placeholder text: > >> > >> http://diveintohtml5.org/forms.html > >> > >> Martijn > >> > >> On Mon, Apr 26, 2010 at 9:19 AM, Josh Kamau > >> wrote: > >> > Hi guys; > >> > > >> > I would like to put some shadow text on the form input fields that > >> > disappears when one starts editing the field. The kind that > appears on > >> > facebook fields. How do i do it. Most likely its not a wicket > issue but > >> i > >> > really need assistance in this. Am not very good in javascript. > >> > > >> > Kind regards > >> > > >> > Josh > >> > > >> > >> > >> > >> -- > >> Become a Wicket expert, learn from the best: > http://wicketinaction.com > >> Apache Wicket 1.4 increases type safety for web applications > >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.7 > >> > >> > - > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > >> For additional commands, e-mail: users-h...@wicket.apache.org > >> > >> > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Shadow text on input fields
I wish we could have something like myTextField.setDefaultText("Type text here"); On Mon, Apr 26, 2010 at 11:55 AM, Josh Kamau wrote: > Thanks Marjtin > > > On Mon, Apr 26, 2010 at 11:27 AM, Martijn Dashorst < > martijn.dasho...@gmail.com> wrote: > >> If you can get away with it, you can use HTML5's placeholder text: >> >> http://diveintohtml5.org/forms.html >> >> Martijn >> >> On Mon, Apr 26, 2010 at 9:19 AM, Josh Kamau >> wrote: >> > Hi guys; >> > >> > I would like to put some shadow text on the form input fields that >> > disappears when one starts editing the field. The kind that appears on >> > facebook fields. How do i do it. Most likely its not a wicket issue but >> i >> > really need assistance in this. Am not very good in javascript. >> > >> > Kind regards >> > >> > Josh >> > >> >> >> >> -- >> Become a Wicket expert, learn from the best: http://wicketinaction.com >> Apache Wicket 1.4 increases type safety for web applications >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.7 >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> >
Re: Shadow text on input fields
Thanks Marjtin On Mon, Apr 26, 2010 at 11:27 AM, Martijn Dashorst < martijn.dasho...@gmail.com> wrote: > If you can get away with it, you can use HTML5's placeholder text: > > http://diveintohtml5.org/forms.html > > Martijn > > On Mon, Apr 26, 2010 at 9:19 AM, Josh Kamau wrote: > > Hi guys; > > > > I would like to put some shadow text on the form input fields that > > disappears when one starts editing the field. The kind that appears on > > facebook fields. How do i do it. Most likely its not a wicket issue but i > > really need assistance in this. Am not very good in javascript. > > > > Kind regards > > > > Josh > > > > > > -- > Become a Wicket expert, learn from the best: http://wicketinaction.com > Apache Wicket 1.4 increases type safety for web applications > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.7 > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Shadow text on input fields
If you can get away with it, you can use HTML5's placeholder text: http://diveintohtml5.org/forms.html Martijn On Mon, Apr 26, 2010 at 9:19 AM, Josh Kamau wrote: > Hi guys; > > I would like to put some shadow text on the form input fields that > disappears when one starts editing the field. The kind that appears on > facebook fields. How do i do it. Most likely its not a wicket issue but i > really need assistance in this. Am not very good in javascript. > > Kind regards > > Josh > -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.4 increases type safety for web applications Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.7 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Shadow text on input fields
Hi guys; I would like to put some shadow text on the form input fields that disappears when one starts editing the field. The kind that appears on facebook fields. How do i do it. Most likely its not a wicket issue but i really need assistance in this. Am not very good in javascript. Kind regards Josh