In my form I need to validate that user has selected record or not in table view (locked).
Table view is loaded with SQL, when we say foundset.getSelectedIndex() gives 1st record in table view even if record is not selected. How to check whether user has selected record or not in tableview.
Hi,
In Servoy when a form (any type) has a foundset with records then at least 1 record is already selected. So foundset.getSelectedIndex() always gives a positive value back.
Only when there are no records in the foundset the value will be 0.
What are you trying to accomplish exactly ?
I am working on a form that display data in table view. Need to check that user has selected record and hits button. Is there any way where we can check that user has selected record ortherwise prompt them to select record in table view.
Hi,
getSelectedIndex() shows the currently active record or record that was selected by the user. When the form opens, the first record gets “selected” by default. I understand you don’t want this initial selection to count as a selection by the user. What you could do is add a vorm var:
var _initialSelection = true;
and in the onRecordSelection set it to false. Then when the user clicks the button you can test the form variable to see if it is a valid selection or not.
I hope this is what you mean?
Kind regards,
Awesome. It worked. Thanks Robert and Omar.