= a!formLayout( label: "Applications", instructions: "Submit a college application", firstColumnContents: { a!sectionLayout( label: "Students", firstColumnContents: { load( local!gridSelection: a!gridSelection( pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 5, sort: a!sortInfo( field: "stud_name", ascending: true ) ) ), with( local!datasubset: a!queryEntity( entity: cons!UNIVERSITY_STUDENT_ENTITY, query: a!query( selection: a!querySelection( columns: { a!queryColumn( field: "stud_id" ), a!queryColumn( field: "stud_name" ), a!queryColumn( field: "stud_lastName" ), a!queryColumn( field: "stud_hobby" ), a!queryColumn( field: "stud_dob" ), a!queryColumn( field: "stud_placeBirth" ), a!queryColumn( field: "stud_areaInterest" ), } ), pagingInfo: local!gridSelection.pagingInfo ) ), a!gridLayout( label: "Select students that would like to apply", headerCells: { a!gridLayoutHeaderCell( label: "ID" ), a!gridLayoutHeaderCell( label: "Name" ), a!gridLayoutHeaderCell( label: "Last Name" ), a!gridLayoutHeaderCell( label: "Hobby" ), a!gridLayoutHeaderCell( label: "Date of Birth" ), a!gridLayoutHeaderCell( label: "Place of Birth" ), a!gridLayoutHeaderCell( label: "Area of Interest" ) }, rows: { a!applyComponents( function: rule!University_universityRow( student: local!datasubset.data, index: _ ), array: if( or( isnull( local!datasubset.data ), local!datasubset.totalCount < 1 ), {}, 1 + enumerate( count(ri!student) ) ) ) } ) ) ) }, secondColumnContents: {} ), a!sectionLayout( label: "Universities", firstColumnContents: { load( local!gridUnivSelection: a!gridSelection( pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 5, sort: a!sortInfo( field: "univ_name", ascending: true ) ) ), with( local!univdatasubset: a!queryEntity( entity: cons!UNIVERSITY_ENTITY, query: a!query( selection: a!querySelection( columns: { a!queryColumn( field: "univ_id" ), a!queryColumn( field: "univ_name" ), a!queryColumn( field: "univ_country" ), a!queryColumn( field: "univ_city" ), } ), pagingInfo: local!gridUnivSelection.pagingInfo ) ), a!gridField( instructions: "Select Universities the students would like to apply to", totalCount: local!univdatasubset.totalCount, columns: { a!gridTextColumn( label: "Name", field: "univ_name", data: index( local!univdatasubset.data, "univ_name", null ) ), a!gridTextColumn( label: "Country", field: "univ_country", data: index( local!univdatasubset.data, "univ_country", null ) ), a!gridTextColumn( label: "City", field: "univ_city", data: index( local!univdatasubset.data, "univ_city", null ) ) }, identifiers: index( local!univdatasubset.data, "univ_id", null ), value: local!gridUnivSelection, saveInto: { local!gridUnivSelection, a!save( ri!application.university_id, local!gridUnivSelection.selected ) }, selection: true, requireSelection: true, requiredMessage: "Must select a University" ) ) ) } ), a!sectionLayout( label: "About yourself", firstColumnContents: { a!textField( label: "Primary Major", labelPosition: "ABOVE", saveInto: {}, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Secondary Major", labelPosition: "ABOVE", saveInto: {}, refreshAfter: "UNFOCUS", validations: {} ), a!paragraphField( label: "Description", labelPosition: "ABOVE", instructions: "Tell us about yourself in a few sentences", saveInto: {}, refreshAfter: "UNFOCUS", height: "MEDIUM", validations: {} ) }, secondColumnContents: {} ) }, secondColumnContents: {}, buttons: a!buttonLayout( primaryButtons: { a!buttonWidgetSubmit( label: "Submit Application", style: "PRIMARY", saveInto: {} ) }, secondaryButtons: { a!buttonWidgetSubmit( label: "Cancel", style: "NORMAL", value: true, saveInto: ri!cancel, skipValidation: true ) } ), validations: {} )