Hi,

When a user inserts or updates a datasource and leaves the current row or presses commit, i need to verify the values of the fields. The fields that are wrong, should be indicated to the user. For example, fields with errors should get a red background color. What is the easiest way to do this?

I have tried the Formspider domains but they can not be used everytime. For example, i created a numeric domain to force values between 0 and 999, but when i type in 123456 the field is made empty without any message. It does not say "values must be between 0 and 999", nor does it say that the value is too large and ignored. Users do not understand that. Worst of all is that when a row has a value outside the domain, that row is not displayed. So when you want to change a domain only for new rows, you can not see the old rows anymore. Also, almost every table has mandatory text fields without domains and without list-of-values.

I have studied http://theformspider.com/learningcenter/tutorial-39-how-to-use-row-cell-level-grid-attributes/ but that is much too complex... I can not believe that i have to add virtual columns to my views to indicate errors in fields. I would expect a simple API like api_datasource.setstylefield ('datasource.field', 'background-color', 'red') or something like that.

Please advise.

Kind regards, Jan Willem Vermeer

asked 24 Sep '15, 06:39

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1231434
accept rate: 0%

Hi Jan,

This was requested by me long ago. But I did not get a satisfactory solution. This is the thread: http://osqa.theformspider.com/questions/2748/problem-with-setting-the-background-color-of-grid-item. In this regard, I remain an unsatisfactory developer though I am active user of formpider tool.

Regards.

George.

(25 Sep '15, 05:36) grajan777

Hi Jan,

I was going to write my own answer to this question but I think all the answers are already given. I personally don't think there is anything terribly wrong with adding a column to a view and use that column to define color. It would be nice if Formspider would allow virtual columns on datasource definitions but it doesn't. So we create the virtual column by adding it to the underlying view. It is a pragmatic solution.

Michael also pointed out the new API. I think one of the two options should solve your problem.

Kind Regards,
Yalim

(28 Sep '15, 05:42) Yalim ♦♦

Hi Jan-Willem,

This indeed is an issue since the beginning of Formspider... But with the new version 1.9 there might be a possibility, although i had no time to test this with 1.9 yet.

In 1.9 there is a new api_component.setstyleclass. I have already in my appliction a check on table required columns (i use api_datasource.getrequiredcolumnviolations and some custome code to check optional required columns (set to required at runtime)) When there are violations in the table i show these errors in a cell on top of the table, like this: alt text

Nice thing about this way of showing errors is that the user has the time to look at the error messages and correct them without having to remember the errors when they are shown on a (modal) dialog.

Now with the new api_component.setstyleclass it might be possible to set a styleclass to the erroneous columns at the time i detect a column violation, but looking at the api, i just have a in_paneldotcomponentname_tx param, so might not work to only set the style class to a single table field.. I should test this..

regards, Michiel

link

answered 25 Sep '15, 08:04

Michiel%20A's gravatar image

Michiel A
5161548
accept rate: 13%

edited 25 Sep '15, 08:07

Hi Yalim,

All i ask is a simple API to set the styleclass for a column in a specific row. Is that really impossible?

The API Michael referred to can not be used because it changes the styling for all rows.

I need more than one exception, for example yellow for mandatory fields, red for wrong entered values (for example emailaddresses) and blue for warnings. How can i do that with fake columns to a view? That is too complex. In my opinion (but who am i) it is also not logical to put styling between data.

Kind regards, Jan Willem

link

answered 28 Sep '15, 07:23

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1231434
accept rate: 0%

Hi Jan,

It is not impossible. It would be nice to have this API. But it doesn't exist today. Yet, the alternative we suggested does exist. The only difference is to add extra columns to views where this is needed. I don't understand how this increases complexity to an unacceptable level.

Mixing data with styling is indeed frowned upon. But it seems like having one without the other is also useless. So maybe they are not that independent of each other after all. :-)

If you think of your datasource definitions as a transformation layer between your data and your UI, then having them both at the same place is not only that terrible but actually desired. The SQL in datasource definitions transforms your data so that it is meaningful for your UI. (The presentation of the data is often very dependent to the data.) Now you have a very good place to go to, if you want to change the presentation style in your UI.

Besides, there is a not-so-small performance benefit. :-) Now that the styling information is in the SQL, you have the added benefit of executing one less loop for the fetched rows. If the styling information is not in the SQL, then we either had to execute one more loop to figure out the presentation style of the data or execute many API's and set grid cell's. Now we get away doing all of these in SQL.

Kind Regards,
Yalim

link

answered 28 Sep '15, 08:34

Yalim%20Gerger's gravatar image

Yalim Gerger ♦♦
1.8k5
accept rate: 15%

Hi Yalim,

From the tutorial i learn 1) every textfield can have a backgroundColorColumn and 2) with api_datasource.setColumnValue i can set the value for that backgroundColorColumn.

In my case views can have up to 100 columns ! Some of them are mandatory, some of them have domains and always go right and some of them need external checks when entered. So, the styling of each column can be different.

My conclusion is that i have to add a backgroundcolumn for every column of the view. So i get views with a couple of hundred of columns only to color a background color for a wrong item red...

Also, these checks are done while users are updating existing rows and adding new rows. For a new row i have to enter all these backgroundcolor values somehow.

I understand what you are saying and guess it works perfect for reports to indicate one or two columns with special values. But it is much too complex for checking the values of complete datasets.

I have looked at this work-around:

1) Add column "fieldMandatoryBGColor" to each view.
2) Add column "fieldValueWrongBGColor" to each view.
3) Check on updates - loop along all fields, check their values:
   if null while mandatory set HOW???? their backgroundcolumn attribute to fieldMandatoryBGColor.
   if wrong set HOW???? their backgroundcolumn attribute to fieldValueWrongBGColor.

But that also does not work. Well, i did not find the API to set the backgroundcolumn attribute... If there is, this would almost be the same as the function i need.

Kind regards, JW

link

answered 28 Sep '15, 10:03

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1231434
accept rate: 0%

Hi Yalim,

With api_component i can set the font color of a column in one row with procedure setFontColor. Why does that procedure (and also setEditable and setEnable) allow a row-id while most other procedures do not? For me this is not logical.

My problems would be solved if setFont, setFontSize, setFontStyle and setBackGroundColor would also allow a row-id. You must have the logic to pinpoint to one column/row for setFontColor, setEditable and setEnable. So why not change these procedures? I know you have other work to do, but for me this is by far showstopper number 1.

Kind regards, Jan Willem

link

answered 02 Oct '15, 09:34

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1231434
accept rate: 0%

Hi Yalim,

As you know we are live now for some weeks and it appears we really need an API like described above to make problems more clearer to the users.

Did you already discuss this in the development team?

If it can not become a regular API, is it possible to create a custom API for customers that need this?

Kind regards, Jan Willem

link

answered 03 Nov '15, 03:02

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1231434
accept rate: 0%

By the way, it does not have to be solved today offcourse, but i want to tell the users that errors will be more clearer in a few months or so.

(03 Nov '15, 03:03) Jan Willem V...
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×12
×3
×3
×2

Asked: 24 Sep '15, 06:39

Seen: 1,300 times

Last updated: 03 Nov '15, 03:03


© Copyright Gerger 2017