Friday, March 5, 2010

My Unanswered questions in XPages

 Assume that you have a Edit box control named "MyXSPField" on a XPage.
Now If I want to retrieve the value of the same on a button click, I can do it in the following ways,
 i,
   var fieldValue=document.getElementById("#{id:MyXSPField}").value

 ii,
   var computedId= "#{id:MyXSPField}";
   var fieldValue=document.getElementById(computedId).value

But when I attempt to split the parameter as follows, no matter what ever way that I try, which makes sense to me, the attempt fails to give me the field value
 i,
   var editControlName="MyXSPField";
   var computedId= "#{id:"+editControlName+"}";
   var fieldValue=document.getElementById(computedId).value


 ii,
   var editControlName="MyXSPField";
   var fieldValue=document.getElementById("# 
   {id:"+editControlName+"}").value

 iii,
   var editControlName="MyXSPField";
   eval ('var fieldValue=document.getElementById("#
   {id:"+editControlName+"}").value');

 iv,
   var editControlName="MyXSPField";
   eval ('var fieldValue=document.getElementById("# 
   {id:"'+editControlName+'"}").value');

 v,
   I have tried replacing # by $ in all of the above mentioned attempts

Yes.. All of these attempts fail. I understand that I am breaking the EL (expression language) and that might be the issue....

But is there a way to instruct the XPage compiler to complile the dynamically created EL, 'cos this is a real worrying issue







3 comments:

  1. Hi Sir,
    Thanks to your reply,I hope that will be working fine.

    ReplyDelete
  2. Hello!

    I am with the same problem.
    Did you solve it?

    Regards,
    Thiago

    ReplyDelete
  3. Nope. Had an opportunity to speak with Philip Ryand (Chief Xpage Architect)and Stephan H. Wissel. They say this is not possible. Seems like we are stuck with it

    ReplyDelete