Save as Word Document | Find | English | Portugues(Brasil)

Techinical Reference
Adding Pieces of JavaScript Code

How to add a piece of JavaScript to your code so that it interacts with the created document.

Table of contents
1. The IModule Interface
2. Data Repository - AnyDataSet
3. Uploading Documents
4. Grouping data entries in XMLNuke
5. Personalized validation in JavaScript
6. Adding Pieces of JavaScript Code
7. Creating your own XML objects
8. Internationalization with XMLNuke.
9. Processing Events with the Click of a Button.
10. Automatically defining the values of Properties

On this page
Adding pieces of JavaScript code
XMLNuke Objects that generate JavaScript


Adding pieces of JavaScript code

It's possible to add pieces of JavaScript code to XMLNuke that can interact with the generated document. To do this, XMLNuke implements in a native manner a function in JavaScript which allows it to "connect" to a text box, an event and a JavaScript code.

JavaScript Function
fn_addEvent("name_box_text", "JS event", functionJS);

To add a JS code, the addJavaScriptSource() method existing in the XMLNukeDocument object must be used. In the example below, we will add a JavaScript to the control when the CHANGE event is set off.

Example
fn_addEvent('iddocumenttype', 'change', cleanDoc);
				
function cleanDoc(e) 
{
	numdoc = document.getElementById('numdocument');
	numdoc.value = '';
}

XMLNuke Objects that generate JavaScript

Some objects in XMLNuke generate JavaScript code which can be used by other functions. The XmlInputGroup function generates a function called showHide_[nome do grupo](bool) which allows the "name of group" name of group to be shown or hidden.

All of the Input objects can generate personalized JavaScript to validate the entered content.

Previous
Personalized validation in JavaScript
Next
Creating your own XML objects