You are viewing limited content. For full access, please sign in.

Question

Question

function(index)

asked on April 2, 2018 Show version history

I want to identify a selected row for a collection, this for get the diferent values into this row?

0 0

Replies

replied on April 3, 2018

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.

See help link https://www.laserfiche.com/support/webhelp/Laserfiche/10/en-US/administration/#../Subsystems/Forms/Content/FieldCalculations.htm

0 0
replied on April 4, 2018

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

 

 

0 0
replied on April 8, 2018

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);
}

 

0 0
replied on April 9, 2018

Hi Rui,

Thanks so much for the code, I tasted it and its works perfeclty, thanks so so much

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.