Problem with repeat region when only 1 record is returned

G

gp

Hello

Can anyone help with the following.

I have a text field (cust) on a page that i need to update from a pop
up window using a repeat region.

The javascript code i'm using is:

function customer(val) {
window.opener.document.newcase.cust.value=val.value;
window.close();
}

On the pop up window i use another text field (custname) in a form
called custlist to filter the recordset.

The onclick event to select the record from the repeat region is as
follows:

onclick="customer(document.custlist.custname[<%=Repeat1__index
%>]);return false"

This all works fine if the repeat region returns more than 1 record.
If however, the repeat region only returns 1 record i get an error
saying 'value' is null or not an object when i select the record.

For example, the repeat region displays all 700 records when the pop
up window opens, and i can select 1 of these records and it sends this
to the text field on the main page. If i use my filter text field and
type say 'acr', 5 records are returned and i can select one of these
and this agin works no problem. If i typed say 'acra', only one record
is returned because there is only one entry beginning acra, when i
select this i get the 'value' is null or not an object error.

Has anyone any ideas how i can resolve this so that regardless of how
many records are in the repeat region, ie, 1, 5 or 700, i can populate
the text field on my main page.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,251
Members
46,850
Latest member
Brightrs

Latest Threads

Top