Help w/Scripting - Need to fetch two records from a form

Help w/Scripting - Need to fetch two records from a form

I am using a "lookup formula" on a form and have used the following script to fill in info once the look-up field is selected. The only issuse I am having is that I need to have two fields fill in on user input and I can only get the one to work. The second record is the "Contract_Date" - can the field be named the same on both forms and how do i get a date to work? (as opposed to a string or a number) any help would be appreciated!


//checking for a valid selection  
if (input.Select_File  !=  "-Select-")
{
    rec  =  Sheet_One  [File == input.Select_File];
    // fetching the corresponding records
    input.Named_Insured = rec.II_Named_Insured;
    //assigning the value  
}
else
{
    input.Named_Insured = "";
}