I want to identify a selected row for a collection, this for get the diferent values into this row?
Question
Question
Replies
Hi Yazmin,
Do you mean the function INDEX() in Forms calculation?
INDEX() function is used to find an item in an array.
ROW() function is used to get the index.
Hi Rui,
Thanks for your coments, I would like to show you how I am using my form and the data I want to obtain.
This is my form
I use a SQL DB to fill the collection "Digitalizar" and the button "Digitaliza" use this HTML code to call a function for fill a template
In Java I use this function to fill the template
The result of my form is the next, what is correct for that I want
When I click on the "Digitaliza" button, it opens the application correctly and allows me to scan without any problem, this when it is done with the first element of the collection corresponding to the element "Documento" "3 - Copia de identificación oficial vigente", the problem happens when I click on the next element "4 - Copia de comprobante de domicilio", the button send the information for the firt one, I refer to the index to identify those elements, and send the correct information to do click in every thiferent button, this is the result
For every click y send the same data
So you meant getting index of the button with javascript? You could use script like this with the button html definition changed from "myFunction(this.id)" to "myFunction(this)":
function myFunction(element) { event.preventDefault(); var index = $(element).closest("div.form-q").index(); console.log(index); }
Besides, if you just need to get element value in the same collection row as the button, you don't have to use the index to find the values.
Possible solution is like this:
function myFunction(element) { event.preventDefault(); var row = $(element).closest("div.form-q"); var value = row.find('#q4 input').val(); console.log(value); }
Hi Rui,
Thanks so much for the code, I tasted it and its works perfeclty, thanks so so much