This content has been marked as final. Show 15 replies
I assume you are very familiar with the Understanding Validations section here on p. 308 (Section 8-32) of the 4.2 Guide.
And especially, "Creating a Validation for a Tabular Form Column" on page 8-37 and "Creating a Validation for a Tabular Form Row" on page 8-38.
I looked at your example. Question: What approach are you taking to validating? Are you validating a row at a time when focus changes? Or a page at a time looping through all the rows?
Hi thanks for the reply , I am fairly familiar with the Validations on the Tabular form and I could probably do it fairly easily using those
but unfortunately the customer does now want the users stopped from saving the form
they merely want to remind them when the are entering data
users eh !!
My aim is when the user enters a value > 0 in either column 1 or column 2 and then that text item in the column loses focus then if the Absence text area is null
the above validation should only fire on the rows with 'Vacation' and 'Sickness' in the description
When do you plan to issue these alerts? It will NOT be when Submit is pressed, right? Unless you are going to have an "Are you sure you want to Submit" pop-up with a list of all the alerts.
So are you going to alert for each row as focus is lost -- when they move the cursor out of a given field? To do that we need to know when an alertable item loses focus. How does one determine that?
Edited by: Howard (... in Training) on Apr 11, 2013 8:18 AM
its fairly simple to do that in the dynamic actions
its a selectable event in the drop down list for a jquery selector of type 'input'
at the moment i can get the alert to fire when focus is lost the value is > 0 and the absence field is null
I just need to confine it to the scenario already mentioned
All the code is available in the example in the dynamic action section and is as below
Event - Lose Focus
Type - jQquerySelector
jQuerySelector - Input
Code - parseFloat(this.triggeringElement.value) > 0 && $v('P2_ABSENCE') == ""
Event when True - Alert ('Please enter a value for absence cover');
Its exacly the same as in my post above , Howard do you have anything to contribute to a solution to my question ??
if you are interested in the solution simply watch the thread and await replies from other people all you are doing now is simply polluting the thread with pointless replies which other people have to read through and will put them off providing a solution
Just to summarize you have the validation now working on all rows but you want it only working for rows where the descirption is Vacation or Sickness.
There are 2 ways to go about getting an element in the same row as the triggering element
1) By traversing first up to the nearest TR element and then to the element you want. Use jQuery for that.
2) Changing the element description to "Display only save state" The element now has an id just like the the triggering element.
The id of tabular form input elements consist of two parts the f array number and the rownumber FNN_XXXX.
You can get the id of the description field by splitting the id to get the rownumber and add that to the F array part of the discription field.
You probably would want a function returning true or false to use in the condition.
Thanks for the reply
I have managed to get the validation to fire just on the first two columns by giving them an element_attribute class and then using that in the jquery selector instead of input , which was firing on all items
now to restrict it to rows
if i can get the ID as you mention in (2) then I can get the value of that element
column_1_id = 'f01_' + $(this.triggeringElement ).attr('id').substr(4);
and once I have the ID of the element in column 1of that row that has just been updated then I can get the value and check if its 'Vacation' or 'Sickness'
I don't totally understand your requirement. Is this validation to fire when ANY input item loses focus on the page? Ie the items in the tabular form and the abscense item? This would mean the validation would have to check every row in the tabular form currently displayed (and what if not all records are displayed, if this can happen?)
Or do you need a validation to fire after changing the item column 1 or 2, and when their value is larger than 0 and the description is vacaction or sickness, then give an alert?
Its the last sentence of your post
validation to fire after changing the item column 1 or 2, and when their value is larger than 0 and the description is vacaction or sickness, then give an alert?
I have sorted the requirement to only fire for columns 1 and 2
there will be others that can be added in the description column so i need it to be dynamic that it checks the row thats updated only
I've looked at the previousnode syntax but don't understand it , if I could use that to go 3 previousnodes back and get the value it could work