Thursday, January 31, 2008

First Posting

First posting hurray,

Presently I have JSF working with the Tomahawk and Trinidad libraries.
Also I have got Ajax functionality working with JSF, particularly the JQuery library.

There was an initial stumbling block with the DOM.

For example JSF transforms,


<form id="myForm">
...
<div id="myElement"> ... </div>
</form&#062


into


<form id="myForm">
...
<div id="myForm:myElement"> ... </div>
</form>


Which appears to me to be embedding namespace information in the elements.


The problem here is the ':' appears to kill Ajax's ability to locate that tag.  

So if I have an initialization function in Ajax for the webpage,

function init(){

// I want to hide the
tag from above
$("myForm:myElement").hide();

}

The referencing scheme above fails to execute the desired function.

So a first thought is to try and use an escape character, '\'

Giving us,
$("myForm\:myElement").hide();

Which again fails to execute,

After playing around with some over avenues in JSF, particularly the forceId="" attribute which allegedly provides direct access and control to what JSF will populate the id="" attribute with.  But I could never get that functionality to work.

So I returned to the escape character method and on a lark tried using two escape characters giving us,

$("myForm\\:myElement").hide();

Which does in fact appear to work.

I am speculating that means that there are two stages of parsing going on and the leading slash protects the second slash so that it is present when the name resolution happens.

Beyond that I have a webservice set up to receive text messages from MobileEd and insert them into the database.

My demo page is 

http://torvalds.cis.uncw.edu:8080/uncwsms/CommunityTip.faces

Enough for a first posting.  Off to negotiate other issues.

No comments: