Change image element image with Javascript

koze85

Member
Hello I searched everywhere in the forums and wiki but cant find the answer
I am trying to change the image of an image element with javascript and it doesnt change with the
var imgelement = Fabrik.getBlock('form_1').formElements.get('users___img');



imgelement.update('fullpathtoaURL');

nor with the
imgelement.set('fullpathtoaURL');

and if I try to read its value (currently it has a predifined image from backend)

alert(imgelement.get('value'));

I get only "/" as an output

Does anyone know how can I change the image and the value that holds in the hidden textbox of the image element?
 
Also I found out that Fabrik.getBlock('form_1').formElements.get('users___img').image holds the image so Fabrik.getBlock('form_1').formElements.get('users___img').image.src holds the source of the image that I want to change... when I try to change that value from the console it changes but if I try from the javascript window of the element it doesnt. It doesnt actually do anything at all even if I try alert(Fabrik.getBlock('form_1').formElements.get('users___img').image.src); No popup box is generated but if I try this from the console it does... I am a bit troubled here how does actually Fabrik render the javascript and how can I archieve what I want ??? anyone please?
 
Back
Top