Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How to catch an error if a field is empty in an array

Hi Anil,

Your problem is just you get only first item with code:

pre

//It's necessery to understand that's this code returns only first item with name "Offer_image".
//This code works globaly for all document. And here is no linking to current element
Apperyio("Offer_image");

/pre

Please use following solution to get it work:

1 Open your mapping.

2 Find "mobilegrid_1" component and click "Edit JS". http://prntscr.com/47n441/direct

3 JS editor will appear. Populate it with following code:

pre

//Note "files/resources/image/no-image.jpg" is default image. You can replace it with your default image url.
var src = value.image ? Appery.getImagePath(value.image) : "files/resources/image/no-image.jpg";
element.find('[name="Offer_image"]').attr("src", src);

return value;

/pre

That's all.

Regards.

Anil Sagar
Posts: 0
Joined: Fri Jul 04, 2014 1:13 pm

How to catch an error if a field is empty in an array

Many thanks Yuri. This works.

Return to “Issues”