1 Reply Latest reply on Feb 3, 2008 4:15 PM by Pete Muir

    h:commandLink does not work on Safari

    Alexander Sparkowsky Newbie


      this may not be a Seam issue but since I'm using the whole Seam/Jboss stack I'm starting here.

      I'm using JBoss AS 4.2.2.GA with Seam 2.0.1.GA and all its standard libs.

      It seems as if <h:commandLink> don't work on Safari 3/Mac OS Leopard, which they did in earlier prjects with jboss 4.0.5.GA and Seam 1.2.1.GA.

      The commandLink in the following example produces a JavaScript error "Undefined value". It doesn't matter if the action or the form is empty. I've simplified the example but this also happens with a complete form.

      The starange thing is that if I copy the generated HTML source into an html file, open that file and click the "command" link, it works (however an error page is shown since this is not a legal Seam request).

      I've no idea why this browser makes a difference between these two files since I have used <h:commandLink> in many earlier projects with earlier versions of the components. Firefox works without a problem.
      I've already changed the extension of JSF/Seam from .seam to .html. Same error.

      Anyone can help here?


      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      <html xmlns="http://www.w3.org/1999/xhtml"
       <h:form id="aForm">
       <h:commandLink id="theId" >abc</h:commandLink>

      This is the generated HTML. The JavaScript error points to the line with the link.
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
      <html xmlns="http://www.w3.org/1999/xhtml">
      <form id="aForm" name="aForm" method="post" action="/leadspot/test.seam" enctype="application/x-www-form-urlencoded">
      <input type="hidden" name="aForm" value="aForm" />
      <script type="text/javascript" language="Javascript">
      function dpf(f) {var adp = f.adp;if (adp != null) {for (var i = 0;i < adp.length;i++) {f.removeChild(adp);}}};function apf(f, pvp) {var adp = new Array();f.adp = adp;var ps = pvp.split(',');for (var i = 0,ii = 0;i < ps.length;i++,ii++) {var p = document.createElement("input");p.type = "hidden";p.name = ps;p.value = ps[i + 1];f.appendChild(p);adp[ii] = p;i += 1;}};function jsfcljs(f, pvp, t) {apf(f, pvp);var ft = f.target;if (t) {f.target = t;}f.submit();f.target = ft;dpf(f);};
      <a id="aForm:theId" href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.forms['aForm'],'aForm:theId,aForm:theId','');}return false">abc</a><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="_id7" />