webtier@glassfish.java.net

Re: [webtier] Mojarra 2.0.x and Bean Validation : ajax versus regular submit

From: <webtier_at_javadesktop.org>
Date: Tue, 19 Jan 2010 17:27:44 PST

<div class=Section1>

<p class=MsoNormal>Since I went along to see what it takes to write the
javascript equivalent of the f<span class=GramE>:<st1:City w:st="on"><st1:place
 w:st="on">ajax</st1:place></st1:City> </span><span
style='mso-spacerun:yes'> </span>client behaviour .</p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Related with original example from Step1</p>

<p class=MsoNormal><span style='mso-spacerun:yes'> </span>&lt;h<span
class=GramE>:inputText</span> id=&quot;title&quot;
value=&quot;#{welcome.title}&quot; label=&quot;Title&quot;&gt;<o:p></o:p></p>

<p class=MsoNormal style='text-indent:.5in'>&lt;f<span class=GramE>:<st1:place
w:st="on"><st1:City w:st="on">ajax</st1:City></st1:place> execute=&quot;</span><b
style='mso-bidi-font-weight:normal'>@this name employer</b>&quot; render=&quot;<b
style='mso-bidi-font-weight:normal'>:messages</b>&quot;/&gt;<o:p></o:p></p>

<p class=MsoNormal>&lt;/h<span class=GramE>:inputText</span>&gt;</p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Becomes</p>

<p class=MsoNormal>&lt;h<span class=GramE>:inputText</span>
id=&quot;title&quot; value=&quot;#{welcome.title}&quot; label=&quot;Title&quot;<o:p></o:p></p>

<p class=MsoNormal><span style='mso-spacerun:yes'>              </span><span
style='mso-spacerun:yes'> </span><span class=GramE>onchange</span>=&quot;jsf2lab1.ajaxRequest(this,
event, '<b style='mso-bidi-font-weight:normal'>@this form1:name form1:employer'</b>,
'<b style='mso-bidi-font-weight:normal'>messages</b>'); return false&quot;/&gt;</p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span class=GramE>I <span
style='mso-spacerun:yes'> </span>noticed</span> some differences : with the f:<st1:City
w:st="on"><st1:place w:st="on">ajax</st1:place></st1:City> <span
style='mso-spacerun:yes'> </span>client behaviour you don’t have to mention the
form name , but tou have to add the extra semicolon for the absolute id. </p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Also jsf2lab1.ajaxRequest is like this </p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>&lt;script type=&quot;text/javascript&quot;&gt;<o:p></o:p></p>

<p class=MsoNormal><span style='mso-spacerun:yes'>            </span><span
class=GramE>var</span> jsf2lab1 = {};<o:p></o:p></p>

<p class=MsoNormal><span style='mso-spacerun:yes'>            </span><o:p></o:p></p>

<p class=MsoNormal><span style='mso-spacerun:yes'>           
</span>jsf2lab1.ajaxRequest = function (source, event, execute, render<span
class=GramE>){</span><o:p></o:p></p>

<p class=MsoNormal><span style='mso-spacerun:yes'>                </span><span
class=GramE>var</span> options={};<o:p></o:p></p>

<p class=MsoNormal><span style='mso-spacerun:yes'>               
</span>options.execute = execute;<o:p></o:p></p>

<p class=MsoNormal><span style='mso-spacerun:yes'>               
</span>options.render = render;<o:p></o:p></p>

<p class=MsoNormal><span style='mso-spacerun:yes'>                </span><span
class=GramE>jsf.ajax.request(</span>source,event,options);<o:p></o:p></p>

<p class=MsoNormal><span style='mso-spacerun:yes'>            </span>};<o:p></o:p></p>

<p class=MsoNormal><span style='mso-spacerun:yes'>       
</span>&lt;/script&gt;<br clear=all style='mso-special-character:line-break;
page-break-before:always'>
</p>

</div>
[Message sent by forum member 'movemountfuji' (movemountfuji_at_gmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=381857