Page 1 of 4
Get image name when clicked
Posted: Mon Apr 01, 2013 6:49 am
by leonardo
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.
Get image name when clicked
Posted: Mon Apr 01, 2013 7:28 am
by Kateryna Grynko
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
Get image name when clicked
Posted: Mon Apr 01, 2013 5:43 pm
by leonardo
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
Get image name when clicked
Posted: Mon Apr 01, 2013 6:17 pm
by Maryna Brodina
Hello! Here is the correct option
codeTiggzi('LabelComponetName').text()/code
Please check component name (by the way it's case sensitive)
Get image name when clicked
Posted: Mon Apr 01, 2013 6:51 pm
by leonardo
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.
Get image name when clicked
Posted: Mon Apr 01, 2013 7:16 pm
by Maryna Brodina
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?
Get image name when clicked
Posted: Mon Apr 01, 2013 7:32 pm
by leonardo
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.
Get image name when clicked
Posted: Mon Apr 01, 2013 7:34 pm
by Maryna Brodina
Could you please share your app with a href="mailto:support@tiggzi.com" rel="nofollow"support@tiggzi.com/a?
Get image name when clicked
Posted: Mon Apr 01, 2013 7:50 pm
by leonardo
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.
Get image name when clicked
Posted: Mon Apr 01, 2013 7:54 pm
by Maryna Brodina