What does .valid accomplish?

What does .valid accomplish?

  

Hi,

Currently trying to make simple form that takes some basic information about a task and sends it to the list of tasks. I'm having 2 issues:


1. I'm trying to validate the form in a save screen action, but it passes no matter what, so I'm not sure what it accomplishes.


2. I have a save action, but it doesn't actually save it. My save action does a CreateOrUpdate once the task is validated (it's always validated, see problem 1), and then sends a feedback success message. The success message comes through, but no new rows are added to the database.


Thoughts?

Artur,

Can you please share your oml.?

So we can have better understanding whats going wrong?

Regards,

Manish Jawla

Hi Artur.


Please make sure that your "Save" button/link have the Validation property set to Client & Server (or Server). If the button/link has Validation set to (none) then all inputs will be considered valid, no matter what. That appears to be very similar to the behaviour you are describing.

Also, make sure that any mandatory inputs have the Mandatory property set to True.


Regarding the CreateOrUpdate, I'm pretty sure that, if that is executed, then the record is stored on the database, unless you rollback the transaction afterwards (which I don't think you are doing). So, please check to see if your list screen is actually listing everything: try removing any joins on your query, or just right-click on the entity in Service Studio, and use the View Data menu.

Should you still need help, please attach a sample so we can take a look on what you've done.

The validate is just a variable, it wont run a validate at the moment you call it, if all the fields on the form are valid, the validate will return true. By default all fields are text fields, if you dont add validators, or have fields which are mandatory valid will always be true. 

Are you sure you are creating new records ? As in the Identity ID field is NullIdentifier() , because when its not the createupdate will just do an update and no rows will be added.


I've attached my .oml here. I seem to have gotten the save button working, but now my delete button won't work (New/Update Task page). Whenever I navigate away from the list all tasks page, I get an error saying, "There was an error processing your request. Please try again later..." Any Suggestions?

Solution

Hi Artur.

I think that your delete button is not working only when you arrive on that page through the New Task button, is that right?

The problem is that, on the New Task button, you are passing the TaskId as being the Id from the table records (TaskTable.List.Current.Tasks.Id), but that button is outside the table records. So this Id will be undefined. You might want to change this value to NullIdentifier() to make it explicit that you are not passing any existing Id.

Having done that, there's a problem with the aggregate on the NewTask preparation: it has no filters! You need to add a filter:

Tasks.Id = TaskId


Also note that the Delete button will not appear when you click on the New Task button. You already had the logic for that (it's the Visible property on the button itself), but it wasn't working because of the bug in your aggregate.

Solution