Welcome Guest Search | Active Topics | Log In | Register

InPlaceEdit Question Options
dondimon
#1 Posted : Tuesday, June 30, 2009 1:12:57 AM
Rank: Member


Joined: 6/1/2009
Posts: 19
Points: 57

I am looking to use the InPlaceEdit control to allow input of an optional field.  If there is no data for the field I want it to say "<enter email address>"  

 Is there a way to capture the click event to "clear" this temporary text.  The click event of this control doesn't seem to get triggered until I click away.

 

<gaia:InPlaceEdit ID="editor" runat="server"></gaia:InPlaceEdit>

 

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then
            editor.Text = "&lt;Enter Email Address&gt;"
        End If

    End Sub

    Protected Sub editor_Click(ByVal sender As Object, ByVal e As Gaia.WebWidgets.AspectClickable.ClickEventArgs) Handles editor.Click
        editor.Text = ""
    End Sub

sergey
#2 Posted : Tuesday, June 30, 2009 6:44:45 AM
Rank: Titan


Joined: 9/23/2008
Posts: 323
Points: 969
You could attach AspectClickable and it will successfully capture mouse click, but unfortunately you won't be able to reset the text of the InPlaceEdit whlie in edit mode. I will add this issue to our bug tracker. Thanks for reporting.
Meanwhile if you really need the functionality I can post a small javascript snippet which will work for your case.
dondimon
#3 Posted : Tuesday, June 30, 2009 4:22:49 PM
Rank: Member


Joined: 6/1/2009
Posts: 19
Points: 57

Thanks Sergey - the javascript workaround would be great.  I'm able to capture the textchanged event and do my validation so I would love to be able to fully use the control.  Thanks again!

nfreeze
#4 Posted : Tuesday, June 30, 2009 8:54:25 PM
Rank: Advanced Member


Joined: 9/18/2008
Posts: 61
Points: 186
Location: Texas

You might take a look at this:

http://docs.gaiaware.net/InPlaceEditors.ashx

It has a PlaceHolderText property that should do what you need.

sergey
#5 Posted : Tuesday, June 30, 2009 9:04:57 PM
Rank: Titan


Joined: 9/23/2008
Posts: 323
Points: 969

Great suggestion from nfreeze!
I have already opened the tracker item: http://tracker.gaiaware....fault.aspx?p=1&i=357
Meanwhile here is the javascript snippet I promised :-)

Code:
Element.observe(window, 'load', function() {
  var base = Gaia.Extensions.InPlaceEdit.prototype.getText;
  Gaia.Extensions.InPlaceEdit.prototype.getText = function() {
    var text = base.call(this);
    return text === '<enter email address>' ? '' : text;
  };
});



As always put it somewhere at the end of the page.

Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.