locked
Screen data validation problem RRS feed

  • Question

  • I keep taking one step forward and two steps back with my project. Just when I thought it was safe to go back into the Entity designer... bam! VS gets me. :)~

    I created a simple... really simple... Create/Edit screen with a handful of unremarkable fields. Absolutely nothing fancy going on.

    Enter Client, Contract Id (primary keys)... a few unrequired date fields... and a modal picker for contact information. Like I said... nothing fancy.

    I enter the data, click on Save and up pops a validation error...

    Here is the exact wording and format of the error message: Client: A value is required.

    Needless to say I can't create the record.

    I put program stops in debug at several places in the CreatContracts_saving method and checked the data in every field in the record I am trying to Save and every field has exactly the right data in exactly the right format.

    It may be just a coincidence that the word Client: is in the error message or it may be that the system thinks there is something wrong in the field Client which is in the record but I checked it in debug and it does have the correct data in it.

    I'm lost... again. hehehe

      

    Sunday, January 20, 2013 12:21 AM

Answers

  • Update....

    I removed the Modal window picker and the problem was gone.  It may have been caused by the way I had jury-rigged the relationship between the Contracts table and the client contacts table.  I'm working with an existing schema that was not designed with the LS entity designer in mind.  Obviously there was something wrong with the method I used to create the relationship which allowed the creation of the MWP.  Data fields used as keys is optimal.     

    • Marked as answer by Jyuma1 Sunday, January 20, 2013 4:53 AM
    Sunday, January 20, 2013 4:53 AM

All replies

  • More information...

    I changed the names of the Client and ContractNbr fields (the key fields) in the table (it's a new table anyway) and then selected "Update Datasource" I then modified all the references to the old field names in the code replacing them with the new field names.

    I changed Client to ClientIdKey and I changed ContractNbr to ContractNbrKey. I then ran the program and selected the CreateContract screen. I entered all the data... clicked on Save... and up popped the exact same error message: Client: A value is required.

    From that test I must assume that the word Client: is referring to a client side error but beyond that I don't know what else to check. Is there someplace where the run-time error is logged that will give me some clue as to what the program is complaining about?

    Thanks

    Sunday, January 20, 2013 1:19 AM
  • Update....

    I removed the Modal window picker and the problem was gone.  It may have been caused by the way I had jury-rigged the relationship between the Contracts table and the client contacts table.  I'm working with an existing schema that was not designed with the LS entity designer in mind.  Obviously there was something wrong with the method I used to create the relationship which allowed the creation of the MWP.  Data fields used as keys is optimal.     

    • Marked as answer by Jyuma1 Sunday, January 20, 2013 4:53 AM
    Sunday, January 20, 2013 4:53 AM
  • If you create a relationship between two tables that is 1-Many (as opposed to 0..1-Many) then the navigation property that bets created must always have a value, it can't be null (nothing).

    I don't know if that's your problem, but it's the  most obvious thing I can think of.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Monday, January 21, 2013 2:48 AM
    Moderator