Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

value change event on label component doesn't fire

I have a label which is programatically loaded with an image dataurl,
When its value has changed, I want it to copy the data into the src attribute of an image component. Here is the js for the Value Change event:

pre
alert('value changed');

var imagedata = $(this).text();
console.log('imagedata: ',imagedata);

// image is the image element
var image = Apperyio('mobilecontainer').find('[name=logo_image]');
image.attr('src', imagedata);
/pre

The event is not firing, i don't event get the alert box.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

value change event on label component doesn't fire

Hello Terry,

How do you change that label? By default, label component doesn't have a "value change" event. That event exists only for input component.

Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

value change event on label component doesn't fire

the label is inserted after a javascript function has completed. I tried getting the value immediately after, but the label hadn't been changed at that point.

Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

value change event on label component doesn't fire

Ok Sorted.

I used the following code:

pre
// change image src when label changed
$('[name=base64_image]').bind("DOMSubtreeModified", function() {
var imagedata = Apperyio('base64_image').text();
console.log('imagedata: ', imagedata);

Code: Select all

 // image is the image element 
 var image = Apperyio('mobilecontainer').find('[name=logo_image]'); 
 image.attr('src', imagedata); 

});

//populate label
//base64_image is a label to contain the dataurl
var selectedFile = this.files[0];
selectedFile.convertToBase64(function(base64) {
Apperyio('base64_image').text(base64);
});
/pre

Return to “Issues”