TOPIC:

File upload: rewrite existing image 5 years 8 months ago #193939

  • alexxbob's Avatar Topic Author
  • alexxbob
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 19
  • Thanks: 1
Hi Crosstec Team,

I have the last version of Breezing Forms Pro (1.8.7 Stable(900)).
And I have an “File upload” element in my form with “Use HTML5 upload” checked and “Allow multi HTML/Flash uploads “ unchecked, so users may only upload ONE image.

Is it possible to check the checkbox of the already uploaded image when new image is selected?
(See image1 for an example)
Otherwise if user will forget to check the checkbox, two images will be placed.

See an example on your site where you can see 2 uploaded images: crosstec.org/breezingformsdemo/index.php...acktolist=0&start=20

Can this be checked with validation of the “File upload” element? Couldn’t find an example of this check on your Forum.

Kind regards,

Alex
Attachments:

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

Last edit: Post by alexxbob.

File upload: rewrite existing image 5 years 8 months ago #194454

  • Tihomir's Avatar
  • Tihomir
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 3564
  • Karma: 87
  • Thanks: 289
Hi there,

you can try out the following solution :

let's say that you have an upload element "upload" , and checkbox element named "checkbox".

You can simply try out the following script which has to be placed into the validation code box.
GO to your upload element > validation area > check "required" , and put the following script there :
function ff_upload_validation(element, message) {
    if (typeof bfSummarizers == "undefined") {
        alert("Flash upload validation only available in QuickMode!");
        return ''
    }
    if (JQuery('#bfFlashFileQueue' + element.id.split('ff_elem')[1]).html() != '') {

        JQuery('[name="ff_nm_checkbox[]"]').prop('checked', true);
        return '';

    }
    if (message == '') message = "Please enter " + element.name + ".\n";
    ff_validationFocus(element.name);
    return message;
} // ff_upload_validation

If you want to add more checkbox elements in the script , just copy the following line , and change name of checkbox element to the right one :
 JQuery('[name="ff_nm_elementName[]"]').prop('checked', true);

Note : checkbox element will be checked once the form is submitted.

Let me know how it went.

I'm waiitng for feedback.

Best regards
Tihomir
===============================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===============================================
Regards
Tihomir
==========================================
+++ Purchase Professional Support: crosstec.org/en/support/purchase-additional-support.html +++

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

Last edit: Post by Tihomir.

File upload: rewrite existing image 5 years 8 months ago #194499

  • alexxbob's Avatar Topic Author
  • alexxbob
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 19
  • Thanks: 1
Hi Tihomir,

Thank you for your answer. But I think I didn’t explain very well what I meant, I tried your code, and I couldn’t manage it to work.

I’ll try to explain it better by using your form on your site. To make sure we understand each other. Follow the link and see 3 pictures please.
crosstec.org/breezingformsdemo/index.php...acktolist=0&start=20

There is something wrong with the attachments on your forum, couldn’t upload images.
Image_1: postimg.org/image/t7mctovrf/
Image_2: postimg.org/image/jbl9u1pzf/
Image_3: postimg.org/image/9fk6uek7f/

I just want to replace existing/uploaded image with the new selected image, after form is saved.

Otherwise without checking the checkboxes manually, 2 or more images will be shown in the job form/profile, like you see it now on the job form/profile.
I want to have just ONE image all the time without manually checking the checkboxes.

I hope you understand what I mean. And maybe there is another solution for this.

Thank you in advance!

Kind regards,

Alex

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

Last edit: Post by alexxbob.

File upload: rewrite existing image 5 years 8 months ago #194526

  • Tihomir's Avatar
  • Tihomir
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 3564
  • Karma: 87
  • Thanks: 289
Hi Alex,

that's exactly what I've sent you. The only difference is those checkbox elements will be automatically checked once you submit the form.

If you want me to check out the script directly in your backend, you can send me super user credentials and all required info ( name of cb list view , bf form etc ). Let me know and I will send you email.

Kind regards
Tihomir
===============================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===============================================
Regards
Tihomir
==========================================
+++ Purchase Professional Support: crosstec.org/en/support/purchase-additional-support.html +++

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

File upload: rewrite existing image 5 years 8 months ago #194661

  • alexxbob's Avatar Topic Author
  • alexxbob
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 19
  • Thanks: 1
Hi Tihomir,

Thank you for your quick answer.

I’m working on the localhost. It’s not possible to access my backend right now.

The checkboxes are being created automatically with random names after an image is uploaded. I tried to find out the names of the checkbox elements with the Inspector Element in Firefox.

There are two images uploaded right now, and these are the checkboxes.
Checkbox1:
<input onchange="bfCheckUploadValidation('ff_elem100', this, 'ff_nm_bfQuickMode243881[]')" value="1" name="cb_delete_100[0]" id="cb_delete_100_0" type="checkbox">

Checkbox2:
<input onchange="bfCheckUploadValidation('ff_elem100', this, 'ff_nm_bfQuickMode243881[]')" value="1" name="cb_delete_100[1]" id="cb_delete_100_1" type="checkbox">

What name should I use in your code ?

I tried this name for the checkboxes: ff_nm_bfQuickMode243881[]

And this is the name of my upload element in the form: bfQuickMode243881

My code looks like this (but no luck):
function ff_bfQuickMode243881_validation(element, message) {
    if (typeof bfSummarizers == "undefined") {
        alert("Flash upload validation only available in QuickMode!");
        return ''
    }
    if (JQuery('#bfFlashFileQueue' + element.id.split('ff_elem')[1]).html() != '') {

        JQuery('[name="ff_nm_bfQuickMode243881[]"]').prop('checked', true);
        return '';

    }
    if (message == '') message = "Please enter " + element.name + ".\n";
    ff_validationFocus(element.name);
    return message;
} // ff_ bfQuickMode2438_validation

Am I using the wrong name?

Kind regards,

Alex

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

File upload: rewrite existing image 5 years 8 months ago #194677

  • Tihomir's Avatar
  • Tihomir
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 3564
  • Karma: 87
  • Thanks: 289
Hi,

I have a couple of additional questions for you :

1) are you using breezingforms integrated with the contentbuilder

2) are you using html5 upload element

3) could you pls send me screenshot of your form when you inspect those checkboxes

I'm waiting for feedback.

Kind regards
Tihomir
===============================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===============================================
Regards
Tihomir
==========================================
+++ Purchase Professional Support: crosstec.org/en/support/purchase-additional-support.html +++

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

Moderators: ForumSupport
Time to create page: 0.057 seconds

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

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!