Drop Down List Error After Submit

D

davas100

I have a drop-down list that uses a secondry data source (SQL table). The
display name of the drop-down is set to a description and the value is set to
the primary key of the DB entry relating to the description. Everything works
OK (you select the displayed description and the correct code is submitted to
the DB) ... until you submit the form data to the DB. After this the
drop-down shows the value and not the description as before.

Has anyone experienced this error before?
 
S

Scott L. Heim [MSFT]

Hi,

I have not seen this behavior before. When you submit to the database does
the primary key value for this drop-down box get modified?

Can you reproduce this using a simple example?

Thanks,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

davas100

Thanks for your reply Scott...

There is no non-default behaviour set-up with the submit to the database.
The only more complex aspect is a filter on the secondary data source that
restricts the choices.

As an example of the problem:

Table in DB of locations:
LocationCode (key), LocationDesc, LocationType
CDLN, London, 0
CDMN, Manchester, 0
CDNE, Newcastle, 1

(The filter as mentioned above is based on LocationType)

The drop down displays the description (London, Newcastle etc.) but has it's
value set to the LocationCode (CDLN, CDNE). The data is submitted correctly
to the database (user selects London and CDLN is put into the DB). Once the
submit is complete, the drop-down displays the LocationCode that has just
been sent to the DB and it's 'value' is blank.

Hope i explained that as best i can.
 
S

Scott L. Heim [MSFT]

Hi,

Thank you for the additional information. To be sure I am testing properly,
I have a couple of additional clarifications I would like to ask:

- Your secondary data source (Locations) is indeed a SQL table - is your
main form fields based on a different SQL table?
- If the above is yes, is the main table "related" in any way to the
Locations table?
- You indicated there is a filter on the Locations based on Type - how does
this get set? Is this a hard-coded value or is there something the user is
doing to "set" the filter?

Now - this is how I am planning on setting up a test...let me know if this
is correct:

- Create a new InfoPath form from a SQL table (i.e. the Orders table from
Northwind)
- This table has a "CustomerID" field that one must enter when adding a new
order - as such, I was going to make this a drop-down list that uses a
secondary data connection to the Customers table. The drop-down list will
display the customer name but use the CustomerID as the value
- I would then add a new order, select a customer, fill in necessary fields
and then submit

Do these steps appear correct?

Thanks again!

Best Regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

davas100

Scott,

Sorry for the time between replies... I've tried recreating the drop-down
from scratch but with no luck... very frustrating!
- Your secondary data source (Locations) is indeed a SQL table - is your
main form fields based on a different SQL table?
- If the above is yes, is the main table "related" in any way to the
Locations table?

Yes both the main form and the secondary data source are SQL tables. They
are related by a single FK (LocationCode).
- You indicated there is a filter on the Locations based on Type - how does
this get set? Is this a hard-coded value or is there something the user is
doing to "set" the filter?

The filter is hard-coded.
Do these steps appear correct?

Yes that sounds OK... i suggest you try using a filter also.

Regards

Chris
 
S

Scott L. Heim [MSFT]

Hi Chris,

Please accept my apologies for the delay as I was unexpectedly out of the
office for a few days.

Did you get this issue resolved or do you still need assistance?

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

davas100

I eventually fixed the problem yesterday. I think it could have been down to
the design/layout of my form. I did have the drop-down outside of the
repeating section (but bound to that same section). I've now placed the
drop-down in the correct place and it works ok.

Thanks for your help Scott

Regards

Chris
 

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

Top