ABOUT US

|

SUPPORT

|

BLOG

 PRICING  | DOWNLOADS

 

User    Pass    

 

 

 

 

 

 

 

 

 

 

Features

 

Key Benefits

 

Screenshots

 

Standards Supported

 

Pricing

 

Download Now

 

API Documentation

 

Developers Guide

 

Code Examples

 

Updated Builds

 

Technical Articles

 

 

 

 

 

Jump to:

General WebRenderer Functions

  WebRenderer example code base.

 

Advanced WebRenderer functions

 

Application test examples

 

Deploying WebRenderer

WebRenderer DOM

  

  

 

Deploying WebRenderer in a Java Applet

 

 

 

 
Manipluating HTML Forms with WebRenderer

HTML Form manipulation is a fairly straight forward task with WebRenderer. It involves using the IBrowserCanvas method executeScript which allows you to get direct access through JavaScript to HTML Forms on the page.

The HTML Form manipulation example textfield takes a String of the text that you wish to enter into the HTML textfield. There is an "AutoForm" JButton to add the Java textfield value to the HTML form. There is also a Submit Form JButton to submit the HTML form.

 

Download complete HTML Form manipulation example (4.6k)..

 

 

 

 

 

 

 

The key code in this example:

    // Getting a reference to the documents html form, getting reference to the elements
    String javascript = "var form=document.forms[0];"+"var elms=form.elements;" + "elms.length;";
    // Getting the number of elements from elms.length for the html form
    int num = (new Integer(browser.executeScriptWithReturn(javascript))).intValue();
              for (int i=0; i< num; i++) {
                       // Loop through getting each elements name, value and type
                       javascript = "elms["+i+"].name;";
                      String name = browser.executeScriptWithReturn(javascript);
                       javascript = "elms["+i+"].value;";
                       String value = browser.executeScriptWithReturn(javascript);
                       javascript = "elms["+i+"].type;";
                       String type = browser.executeScriptWithReturn(javascript);
                       System.out.println("For Element "+i+" the Name is: "+name+" and value is: "+value+" and type is: "+type);
                        // If the type is a textfield we will set the value to WebRenderer
                        javascript = "if (elms["+i+"].type=='text')elms["+i+"].value='My Value for the HTML textfield';";
                        // Executing the script on the browser to set the textfield with the value
                        browser.executeScriptWithReturn(javascript);
              }

    // Constructing a form.submit JavaScript call
    String javascript = "form.submit()";
    // Executing the JavaScript on the browser
    browser.executeScript(javascript);


This example will work on all platforms. 

  top

 

Millions of deployments and counting.. Users of JadeLiquid's tools can be found in every corner of the Earth

 

   News

 

 > Enabling Flash in WebRenderer - Article
 > Browser Zoom Effect using WebRenderer - Article
 > Applet deployment techniques - Article
 > WebRenderer core features on display! - Article
 
 
   Additional News  
 
 > Enabling HTML 5 WebSockets in WebRenderer - Blog
 > 64bit WebRenderer deployment with Web Start - Blog
 > Deploying WebRenderer Server Edition in Tomcat - Blog
 > WebRenderer 6 adds performance text search - Blog
 

 

 Java and the Java Logo are trademarks or registered trademarks of Oracle Corporation in the United States and other countries 

Privacy Policy  |   Disclaimer