|
From: Dave S. <dav...@ca...> - 2004-03-30 21:27:55
|
If I understand you then I'm going to guess it is Array or Function, but
here is the offending code...
Line 123 is the if (field.type == 'text' etc ...
function required () {
this.aa = new Array("consols.file_num", "House Bill Number is required.", new Function ("varName", " return this[varName];"));
this.ab = new Array("consols.cargo_ctl_num", "Orginal Cargo Control Number is required.", new Function ("varName", " return this[varName];"));
this.ac = new Array("consols.carrier_code", "Carrier Code is required.", new Function ("varName", " return this[varName];"));
this.ad = new Array("invoice.data.country", "Destination Country is required.", new Function ("varName", " return this[varName];"));
this.ae = new Array("invoice.data.city", "Destination City is required.", new Function ("varName", " return this[varName];"));
this.af = new Array("invoice.data.port_name", "Entry Port is required.", new Function ("varName", " return this[varName];"));
this.ag = new Array("invoice.consignee.nameAddr.name", "Consignee Name is required.", new Function ("varName", " return this[varName];"));
this.ah = new Array("invoice.consignee.nameAddr.addr1", "Consignee Address is required.", new Function ("varName", " return this[varName];"));
this.ai = new Array("invoice.consignee.nameAddr.city", "Consignee City is required.", new Function ("varName", " return this[varName];"));
this.aj = new Array("invoice.consignee.nameAddr.prov", "Consignee Province is required.", new Function ("varName", " return this[varName];"));
this.ak = new Array("invoice.consignee.nameAddr.postal_code", "Consignee Postal Code is required.", new Function ("varName", " return this[varName];"));
this.al = new Array("invoice.consignee.nameAddr.country_id", "Consignee Country is required.", new Function ("varName", " return this[varName];"));
this.am = new Array("invoice.consignor.nameAddr.name", "Consignor Name is required.", new Function ("varName", " return this[varName];"));
this.an = new Array("invoice.consignor.nameAddr.addr1", "Consignor Address is required.", new Function ("varName", " return this[varName];"));
this.ao = new Array("invoice.consignor.nameAddr.city", "Consignor City is required.", new Function ("varName", " return this[varName];"));
this.ap = new Array("invoice.consignor.nameAddr.country_id", "Consignor Country is required.", new Function ("varName", " return this[varName];"));
}
function validateRequired(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oRequired = new required();
for (x in oRequired) {
var field = form[oRequired[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'file' ||
field.type == 'select-one' ||
field.type == 'radio' ||
field.type == 'password') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
}
} else {
value = field.value;
}
if (trim(value).length == 0) {
if (i == 0) {
focusField = field;
}
fields[i++] = oRequired[x][1];
isValid = false;
}
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return isValid;
}
On Tue, 2004-03-30 at 16:09, Mike Bowler wrote:
> Dave Smith wrote:
> > I saw this in the archives but no response so I guess I will ask it
> > again. I am testing an application that uses struts with javascript
> > field required checking when a form is submitted. When the user
> > presses save it checks that all of the required fields and filled in
> > and if not pops up an alert box with the fields that are required. I
> > get the following back trace when running my test.
> >
> > [junit] Testcase: testAddWithoutData took 13.554 sec
> > [junit] Caused an ERROR
> > [junit] The undefined value has no properties.
> > [junit] ======= EXCEPTION START ========
> > [junit] EcmaError: lineNumber=[123] column=[0] lineSource=[null]
> > name=[ConversionError] sourceName=[/aci/images/static.js] message=[The
> > undefined value has no properties.] errorObject=[ConversionError: The
> > undefined value has no properties.]
>
> This is a fairly generic symptom that means "some javascript object that
> you're trying to use hasn't been implemented yet". The trick is to
> discover what javascript host object you're referencing so that we can
> implement it (or at least stub it out as a temporary fix).
>
> Can you share the javascript (and the HtmlUnit code you're using to hit
> it)? Even better, is this on a publicly available server that we could
> hit on remotely?
--
Dave Smith
CANdata Systems Ltd
416-493-9020
|