TOPIC:

How can I display an image in textfield or text box? 6 months 1 week ago #257243

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 7376
  • Karma: 3
  • Thanks: 527
Hi,

I will check this first, and then get back to you

Regards,
Tihana

Please Log in or Create an account to join the conversation.

How can I display an image in textfield or text box? 6 months 1 week ago #257428

  • Topic Author
  • Niederhofer
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 100
  • Thanks: 0
Dear Tihana,
some good news on this?

Thanks a lot!
Andreas

Please Log in or Create an account to join the conversation.

How can I display an image in textfield or text box? 6 months 1 week ago #257431

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 7376
  • Karma: 3
  • Thanks: 527
Hi,

this part of code:
var uf=JRequest::getVar('ID');
Here you mixed php and javascript.
Basically in Initialization Script should be javascript.

So, like in Eddy's example go to ID field of form (in Eddy's example there is element with Title Nom and name username)->and in ID's Properities->Value put:
<?php return JRequest::getVar('ID'); ?>

Then the code in Initialization Script is:
function ff_form2_init()
{

var uf = ff_getElementByName('ID').value;

if ( uf != '') {
document.getElementById('form2').innerHTML = '<img alt="User Foto" src="uploads/' + uf + '/foto1.jpg" />';
}
else {
document.getElementById('form2').innerHTML = 'You are not connected. Login to see your photo';
}
}

Hope this helps

UPDATE: or like in Initialization script:
function ff_form2_init()
{

var uf="<?php return JRequest::getVar('ID') ?>";
//var uf = ff_getElementByName('ID').value;

if ( uf != '') {
document.getElementById('form2').innerHTML = '<img alt="User Foto" src="uploads/' + uf + '/foto1.jpg" />';
}
else {
document.getElementById('form2').innerHTML = 'You are not connected. Login to see your photo';
}
}

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic. Reason: added the alternative code

How can I display an image in textfield or text box? 6 months 1 week ago #257459

  • Topic Author
  • Niederhofer
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 100
  • Thanks: 0
Dear Tihana,
thaaanks a lot, I am nearly there. Please dont laugh about my last question to this topic:

My script for display is like this:
if ( uf != '') {
document.getElementById('form2').innerHTML = '<img alt="User Foto Test" src="uploads/' + uf + '/foto1.jpg" />';
}

I get the text "User Foto Test" shown in form section, means that the variable uf is there and the script in brackets is executed.
But foto1.jpg is not shown. It is located in the folder. It must be the path, where I tried different settings, but unsuccessful. I know, that is a very beginners question, as I am, but I always struggle somehow with paths... :(

How would you place this path "C:/xampp/htdocs/joomla/media/breezingforms/uploads/" as relative path into this : src="uploads/' + uf + '/foto1.jpg" ?

Please Log in or Create an account to join the conversation.

How can I display an image in textfield or text box? 6 months 1 week ago #257461

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 7376
  • Karma: 3
  • Thanks: 527
Hi,

How would you place this path "C:/xampp/htdocs/joomla/media/breezingforms/uploads/" as relative path into this : src="uploads/' + uf + '/foto1.jpg" ?

Please test like this:
src="media/breezingforms/uploads/' + uf + '/foto1.jpg"
And please check this part:
document.getElementById('form2').innerHTML 
form2 is div of your form (your should to find it for yours->right click to your browser->Inspect and in Console find it for your form)

P.S: don't worry, ask what you need, I am here to help :)

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

How can I display an image in textfield or text box? 6 months 1 week ago #257464

  • Topic Author
  • Niederhofer
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 100
  • Thanks: 0
Thanks a lot for this nice line: P.S: don't worry, ask what you need, I am here to help !!!!
I tested...it does not work! :(I only get "User Foto Test".

document.getElementById('form2').innerHTML = '<img alt="User Foto Test" src="media/breezingforms/uploads/' + uf + '/foto1.jpg" />';

I checked the jpg. It is in this folder, var uf is correct,... what can be overseen?

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.053 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!