leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Get image name when clicked

codeTiggzi.getImagePath('page_logo');/code
gives the url of the image referenced in Tiggzi. But I want to reference the actual name of the image, like: "foo_2.jpg" so as to isolate the "foo_2" when the image is clicked.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Get image name when clicked

Hi Leonardo,

To get file name on image click use Run JavaScript action with the following code:
codevar urlParts = this.src.split('/')
var imageName = urlParts[urlParts.length - 1];/code

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Get image name when clicked

Thanks, Katya. That did it.
In trying to get a similar result from clicking a label component I thought one of these codes would do it, but it never happened:
codealert("clicked: " + Tiggzi('LabelComponetName').val());
alert("clicked: " + Tiggzi('LabelComponetName').text());/code

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Get image name when clicked

Hello! Here is the correct option

codeTiggzi('LabelComponetName').text()/code

Please check component name (by the way it's case sensitive)

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Get image name when clicked

Ok, I see what it going on. In the UI of the label component that I named filteredName I put : "matching name" as a default text. When I used the code you provided, which I have used before:
codealert(Tiggzi('filteredName').text());/code, it gave me this:
[quote:]matching name[/quote] the default text in UI, instead of the name populated from the rest service.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Get image name when clicked

Looks like you map some results and because of it have a few labels with the same name, or maybe you call that function before you map result. Could you check it and clarify?

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Get image name when clicked

It's kind of strange because the image component and the label component are mapped at the same time to their respective responses, giving the relevant picture and names that match a search criteria. When the image it clicked, the code given above works well. The code for the label should work as well. But no. However, this code works: codealert($(this).text());/code. I am still at a lost why the other code didn't work.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Get image name when clicked

Could you please share your app with a href="mailto:support@tiggzi.com" rel="nofollow"support@tiggzi.com/a?

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Get image name when clicked

Marina, it is shared, with comments in the appropriate areas of the Filtered page. Thanks.
Please note also that I am working on isolating the name through the text of the label and image so I can extract the story node from the DOM. Could you give me a clue as to extracting that information also? Thanks.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Get image name when clicked

What is the app name?

Return to “Issues”