setAutoSubmit Property

Description

This property specifies the way in which Ephox EditLive! for Java behaves when the page is submitted.  This affects how content is retrieved from EditLive! for Java.

Syntax

JavaScript object.setAutoSubmit(blnSubmit)

Parameters

blnSubmit A boolean indicating if EditLive! for Java should attach its content submission to the onsubmit function.
Default:  True

Example

The following code creates an instance of EditLive! for Java and then informs EditLive! for Java to not attach its content submission to the onsubmit function.

var editlivejava1;
editlivejava1 = new EditLiveJava("ELJApplet1","600","400");
editlivejava1.setAutoSubmit(false);

Remarks

When attaching its content submission to the onsubmit function EditLive! for Java populates a hidden field with its contents automatically rather than the developer calling for the contents explicitly. The name of the hidden field is contained within the same form as the EditLive! for Java instance and is given the name that was specified by the developer when the EditLive! for Java instance was created.  For example, ELJApplet1 was specified in the above example (editlivejava1.Name = "ELJApplet1") so EditLive! would store its contents in the hidden field named ELJApplet1.  This hidden field is then posted with the rest of the form data when the submit button is pressed.  
EditLive! for Java automatically updates the hidden field by attaching itself to the form's onsubmit() handler.  If there is already a function specified in the onsubmit() handler then this function will run after the hidden field has been updated.  This means that you can still use the onsubmit() handler to run your own JavaScript functions.  If you use another button/image/event to submit the form by calling form.submit() the browser will not call the onsubmit() handler and EditLive! for Java will not populate the hidden field with data. For this reason, please ensure you use form.onsubmit() to avoid this problem.

When deactivating the onsubmit functionality of EditLive! for Java by setting the setAutoSubmit property to false the developer may wish to retrieve content from EditLive! for Java using the GetBody and GetDocument functions provided in the EditLive! for Java JavaScript Run Time API.

See Also