I have some javascript :
function set(target) 
{

    if (target == 'save') 
    {
        if(verifySomethingChecked('formulaTable', 3) 
          && verifySomethingChecked('monitorTable', 1))
        {   
            setTargetAndSubmit(target);
        }
    }
    else
    {
        setTargetAndSubmit(target);
    }
}

function setTargetAndSubmit(target)
{
    document.tubeFeedingForm.dispatch.value=target;
    document.tubeFeedingForm.submit();
}

function verifySomethingChecked(table, rowToStart)
{
    var table = document.getElementById(table);
    var somethingChecked = false;
    
    for(a=0; a< table.rows[rowToStart].cells.length; a++)
    { 
        var selection =
table.rows[rowToStart].cells[a].getElementsByTagName('input');  //get
the input tags from the cell
        for (b=0; b < selection.length; b++)
        {
            if (selection[b].type == 'checkbox')  //makes sure it is a
checkbox
            {
                if (selection[b].checked)  //if a checkbox is checked,
send back true
                {
                    somethingChecked = true;
                    break;
                }
           }
       }
    } 
    if (!somethingChecked)
        alert("You must select at least one formula AND one monitoring
option");
        
    return somethingChecked;
}

And when testing with jwebunit, it doesn't seem to understand 
 table.rows[rowToStart].cells.length

and throws:

java.lang.RuntimeException: com.meterware.httpunit.ScriptException:
Event 'javascript:set('save');' failed:
org.mozilla.javascript.EvaluatorException: The undefined value has no
properties. (httpunit; line 28)
at
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.handleScriptException(JavaScript.java:192)
at
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.java:165)
at
com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:55)
at com.meterware.httpunit.Button.doOnClickEvent(Button.java:85)
at com.meterware.httpunit.Button.click(Button.java:68)
at
net.sourceforge.jwebunit.HttpUnitDialog.clickButton(HttpUnitDialog.java:784)
at net.sourceforge.jwebunit.WebTester.clickButton(WebTester.java:915)
at net.

Tried to have the error ignored by using 

  HttpUnitOptions.setExceptionsThrownOnScriptError( false );

but it doesn't matter cause it still chokes at that line.  Is there any
resolution to this?

Thanks in advance.


**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be 
used for urgent or sensitive issues.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jwebunit-users mailing list
Jwebunit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to