Editable list view - single row validation

  • 7 February 2020
  • 5 replies
  • 64 views

My end goal is to be able to validate various fields on an editable list view row before the user adds a second row. We want to do it this way rather than validate all the rows at once because that way the user easily knows which rows caused the problem.

 

For a while we were using the "When the View executed List item changed" and "When the view executed List item added" events and those seemed to work well, but now they've stopped firing. I deleted the event rules and re-added them and they worked briefly and then stopped firing again. 

 

  1. Is there a way to validate just my row? If not I'll validate all the rows when the user clicks save.
  2. Can anyone point me to the official documentation for the two specific events listed above? I had to figure out the lifecycle through trial and error because I can't find the documentation for them.
  3. Why are these two events working and then not working?

5 replies

Hi dustinaleksiuk,


 


Kindly checkout the community link below. This post has a similar query as yours. 


The list of helpful links related to row validation is found there.


https://community.k2.com/t5/K2-Five/To-validate-each-row-in-K2-list-view/m-p/112596#M3944


 


Should you feel that this post is of use and or an accurate solution to the raised question, I kindly encourage you to mark it as such
using the 'Mark as Solution', 'Kudo' andor ‘Me Too’ options.


 


Cheers,
Kate


 


K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member.

I appreciate that reply and I had found that post previously. I'm not clear on what they're recommending. The recommendation is to use the "Add new row" event, but that event fires when when a new row is added. I want to validate fields on the row that the user is currently editing before they add a new row.

 

The other 2 events I mentioned in my post work for this, but they seem to be broken. They stop firing after a while even after removing them and re-adding them. They fired for me for a bit and then stopped.

 

I have another view where my approach works but in this current view they don't.

 

 

I know exactly where you are coming from.

I will follow this post to see if there is a resolution.

Currently, as a workaround, I've ended up having a non-editable list view.

1. The user enters the data in Form controls below (and separate from) the view and click a submit button
2. If validation passes it then saves
3. List view is refreshed

4. Form Controls are cleared

Not the ideal way, but at least this way you can do validation on the controls. It just means the User has to enter one row at a time and click a submit button everytime.

I like that approach and wish we would have gone that way. How do you handle edits?

 

We have other screens where we enable an edit button that allows the user to edit the selected row. It opens a modal dialog for that row and we can validate that modal. We can use it for both new rows and editing existing rows.

 

Thanks,
Dustin

With the Lists we have so far, there is no need to validate what is edited.

 

However, I am working on a new project and may run into this problem. I like your idea of having a modal subform/subview, however I not sure if this will work well on a mobile device, I will have to check.

Reply