Solved

Adding color to a blank display row in a list view

  • 14 February 2019
  • 3 replies
  • 13 views

Badge +8

I have a list view where instructors click the add list view button to add a new student.

 

The student comes into a dropdown and the entry normally works fine.

 

If the instructor doesn't add someone, but instead clicks on the add new row button twice, I get a blank row.

 

My question is:  How do I best prevent the blank row problem.  I was thinking of adding a color to the blank row, but I am getting confused in add/edit row values and display row values.  I would like to add some sort of conditional formatting on the field, so the blank rows show up with some color, and the other rows with values are normal.

 

The blank rows which are added are very, very tiny and hard to see on the form.

 

I can skip them when I go to write out valid data to the smartbox object, but it still leaves blank rows on the screen if I run a validation, and they are so hard to see.

 

Suggestions?

 

I don't want remote services, but trying to find an example of building this routine.

 

Thanks!

 

BKlaege

icon

Best answer by RaymondJVR 15 February 2019, 10:59

View original

3 replies

Userlevel 4
Badge +13

Good day BKlaege


 


By the looks of your explanation is seems that you are making use of an editable list view, when the add button is pressed once it will create a temporary empty row for some input which would then need to be saved later on so the data could actually got to the SmartObject. However you also mentioned that when the add button is pressed twice two blank rows are added, one which would have been commited as a blank temporary field an the other which will then be the temporary empty row for some input, when you save the user input the first blank row would then also be saved to the SmartObject. Essentially this first blank row is the one in question, looking at that explanation of the issue and assumign it is correct as (see screenshot below for refrence) the best suggestions would be to avoid the user from being able to create the second blank row in the first place IF the first blank row is still empty 



 


See the below steps on how and where to implement a condition that would disallow a user form adding another blank row whilt he current blank row is still empty.




Steps and Configuration


Step 1: Create your SmartObject and add its properties.


Step 2: Generate a Editable list view from the SmartObject.


By default the a new record can be added by pressing the (Add new row) option OR by pressing the Add button. So we will have to intercept this action and do a validation check before it can be preformed.


Step 3: Navigate to the Rules breadcrumb tab.


Step 4: Locate the rule called "When the View executed List item added" and edit the rule. In this rule the following construction will be noted.


When the View executed List item added



       then apply the changes made to the row on the editable list

 


Step 5: Change this rule contruction to look like the below (See Step 5.1 for the configuration on these added rules):


When the View executed List item added


       if an advanced condition is true
              then show a message to the user (configure)



       else

              then apply the changes made to the row on the editable list

 


Step 5.1: Rule be rule Configuration steps:


When the View executed List item added - Default configuration


       if an advanced condition is true - Add a condition here




              then show a message to the user (configure) - Change the message to display the text you want.



       else

              then apply the changes made to the row on the editable list




Result


This will allow a user to add a new blank row, but will dissallow a user from adding another row instead displaying a message of your choice. The user will only be able to add another blank row once the previous blank row has data inputted.


 


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.


 


Kind Regards


Raymond


 

Badge +8

Raymond,

 

I did find this helpful.

 

I have to say, I was changing several of these rules within the view, as I often have to do with K2, and I was close to the solution.

 

I am checking the count on the list view to see that the person entering has to enter a valid name in the first dropdown field in each row.  I have a submit button that is selected after they are supposed to enter valid data.

 

With the proposed solution, I do need to keep them from multiple adds which are blank, and this seems to deal with this, but I also have to make sure they have entered something in at least 1 row.

 

I noticed with my check, when there was a blank row after a valid row, I was giving success, and then throwing an error message clearing the views and forms.  I enhanced the rule, and checked for the first time where count is still 0, and then when it comes time to create the smartbox object rows, I ignore the blank rows.

 

This keeps me with at least 1 valid row before I can submit, and keeps me from writing all kinds of blank rows, after they enter something valid.   

 

I will attach some screen shots.

 

BKlaege

Badge +8

I'm back.

 

First, I was thinking of using color to show a blank row being created, but the solution as you know has nothing to do with color, as it has to do with not allowing another add to be accomplished if the preceeding row is blank.

 

Your solution seems to take care of the adding part.  It does not address the creation, or the deleting, correcting part which leaves me in some weird places.   However said, when my submit button is selected, I don't write the correct rows.

 

I was originally checking count on the list view, but the count is only incremented after an enter is selected on the dropdown.  Is this by design?

 

My problem is that we need some student selected.  We don't want to add blank lines, and I can't just check count.  Users also want to allow blank selection on the dropdown.  This seems counterintuitive.

 

Is there some example of editing in one of the smartstarters?  Seems as if K2 is getting better in documentation, but I find it almost impossible to find examples.  

 

Remote services is not really the solution for me, there should be some example.  I can't be the first to have a problem editing a list.

 

BKlaege

Reply