How to use Jpoint with jquery click.

Jul 7, 2011 at 6:02 AM

Hello. I have tested this great feature but I don't uderstend it.

for example I have 6 fields on my new.aspx form.
One of then (the first one) is:  SharePoint:FormField runat="server" ID="fieldTitle" ControlMode="New" FieldName="Title"

If I type this code: jP.Form.Items[0].val("Hello"); everything is working without any problem and my field is filled but if I try this:
jP.Form.Items[0].click(function () {
alert("text");
});

or this:
$(jP.Form.Items[0]).click(function () {
alert("text");
});

nothing happen. Is this possible?How can I do this?
And one more question please I know that this is working jP.Form.Items[0].val("Hello"); but is possible to access fields by id or name or something for example jP.Form.Items["fieldTitle"].val("Hello");

Thank you very much for your help.

 

 

Coordinator
Jul 7, 2011 at 8:00 PM

Try this

$(jP.Form.Title.Item).click(function(){
    alert("test")
});

or 

$(jP.Form.Items[0].Item).click(function(){
    alert("test")
});

Hint: Use Firefox Firebug and add watch to jP to see how to reference various form elements. 

Jul 8, 2011 at 5:34 AM

Hello. Thank you very much for your help I tested it but with this result:

$(jP.Form.Title.Item).click(function(){
    alert("test")
});
doesn't work

 

$(jP.Form.Items[0].Item).click(function(){
    alert("test")
});
this works fine.

When I look to error console I get this error:
Error: jP.Form.Title is undefined

So I have tested this again but on another field:
SharePoint:FormField runat="server" ID="fieldVerzia" ControlMode="New" FieldName="Verzia"

with this code:
$(jP.Form.Verzia.Item).click(function () {
alert(
"test")
});

And everything was working without any problem....but with title it doesn't work:(
SharePoint:FormField runat="server" ID="fieldTitle" ControlMode="New" FieldName="Title

 Hmm....What can be a problem? Thank you very much