IsDirtyFunction

Description

This function returns a string depicting whether the current contents of EditLive! for Java have changed since the content that was initially loaded into the editor (either through the <body> element of the XML configuration file or the setBody and setDocument runtime APIs). The string depicting whether the content has been changed will equal either true or false.

Syntax

JavaScript
IsDirty(strJSFunct)

Parameters

strJSFunct

This parameter is required

The name of the JavaScript function that receives the string depicting whether the contents of EditLive! for Java have changed since first being initialised.

Example

The following code creates a JavaScript function which is to be used as the parameter for the IsDirty function. The JavaScript function will output a JavaScript alert of TRUE or FALSE, depending on whether the content of EditLive! for Java has changed since initialisation.

<HTML>
   <HEAD>
      <TITLE>EditLive! for Java JavaScript Example</TITLE>
      <!--Include the EditLive! for Java JavaScript Library-->
      <SCRIPT src="editlivejava/editlivejava.js" language="JavaScript"></SCRIPT>
      <SCRIPT language="JavaScript">
      <!--
         function statusFromDefault(statusString)
         {
            if(statusString == "true")
            {
               alert("TRUE");
            }
            else
            {
               alert("FALSE");
            }
         }
      -->
      </SCRIPT>
   </HEAD>
   <BODY>
      <FORM name = exampleForm>
         <P>EditLive! for Java contents will appear here</P>
         <!--Create an instance of EditLive! for Java-->
         <SCRIPT language="JavaScript">
         <!--
            var editlive_js;
            editlive_js = new EditLiveJava("editlive",450 , 275);
            editlive_js.setDownloadDirectory("editlivejava");
            editlive_js.setLocalDeployment(false);
            editlive_js.setConfigurationFile("sample_elconfig.xml");
            editlive_js.setBody(escape('<p>Some initial text</p>'));
            editlive_js.show();
         -->
         </SCRIPT>
         <P>Click this button to retrieve applet contents</P>
         <P>
            <INPUT type="button" name="button1" value="Check if Content is Different to Default"
               onClick="editlive_js.IsDirty('statusFromDefault');" >
         </P>
      </FORM>
   </BODY>
</HTML>

Remarks

The value passed from the IsDirty function to the specified method is a string, not a boolean value. Therefore, when comparing the value to true or false, represent true or false as strings by enclosing them in quotation marks (i.e. "").