1 Reply Latest reply on Jan 8, 2008 5:46 AM by Ronald van Kuijk

    Problem using Javascript in jbpm-jpdl (xhtml page)

    Kamalika De Newbie

      Hi,

      Here, we want to display a value input in a text box using a Javascript alert in a xhtml form as designed in the jbpm-jpdl designer. However, the code is giving an error. The error is :

      "document.forms.form1.textbox' is null or not an object"

      The code is as follows.


      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
      
      
      <!-- the DOCTYPE means we are required to use html for a root element -->
      
      <html xmlns="http://www.w3.org/1999/xhtml"
      
      xmlns:ui="http://java.sun.com/jsf/facelets"
      
      xmlns:c="http://java.sun.com/jstl/core"
      
      xmlns:h="http://java.sun.com/jsf/html"
      
      xmlns:f="http://java.sun.com/jsf/core"
      
      xmlns:tf="http://jbpm.org/jsf/tf"
      
      xmlns:jbpm="http://jbpm.org/jsf">
      
      
      <script language="java-script">
      
      function foo()
      
      {
      
      alert("Hi");
      
      }
      
      function showTextBox()
      
      {
      
      alert(document.forms['form1'].textbox.value);
      
      }
      
      </script>
      
      
      <FORM name="form1">
      
      textbox: <INPUT name="textbox"/><BR/>
      
      
      
      <!-- the below onClick is not working -->
      
      <INPUT type="button" value="val" onClick = "showTextBox()" />
      
      <A href="#" onclick = "foo()">href</A>
      
      
      
      
      <h:outputText value="#{taskName}"/>
      
      
      
      <!-- TASKFORM ROWS -->
      
      
      <h:outputText value="Variable 1"/>
      
      
      <h:inputText value="#{var['variable1']}" />
      
      
      
      
      
      <h:outputText value="Actions"/>
      
      <!-- TASKFORM BUTTONS -->
      
      <tf:saveButton value="Save"/>
      
      <tf:cancelButton value="Cancel"/>
      
      <tf:transitionButton to="Done" value="Done"/>
      
      </FORM>
      
      
      </html>


      How do we solve this problem.

      Thanks a lot in advance.

      Kamalika