From Validation

Hi everyone! My question concerns the lesson about Form Validation. The logics their was - if we want to add a new project, we have to make sure that its due date is in the future. 


This line is offered in the pdf file attached to the lesson: GetProjectById.List.Current.Project.DueDate > CurrDate()

We should check the form with Due date and if it is in the future, create a new project.

My question is - As I understand when we check the widget, the project hasn't been  created yet. The project will be created and put to database ONLY IF the duedate is OK. So why we don't compare date from the widget and current day? This line (GetProjectById.List.Current.Project.DueDate) takes DueDate from the database, but the project doesn't exist yet... 

Would be grateful if someone clears that out. Thank you

mvp_badge
MVP
Solution

Hi Boyko,


The idea is you get the Project from the database in the case of the edit, or not in case it is a new one.

In any case, your Due Date input value is associated to the GetProjectById.List.Current.Project.DueDate date, so when the user selects a due date on the screen s/he will be editing the GetProjectById.List.Current.Project.DueDate variable and therefore it will hold the value that you validate your form against, and the value you are going to insert in the database if forms validations are ok.


Kind Regards,
João Marques

Now it makes sense , thank you 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.