-2

I can't figure what is wrong , because i receive a message "The requested content cannot be loaded. Please try again later."

<form action="<?php echo site_url('frontend/accelerator/|fltru:true|');?>" method="post" name="product_form"  >
<input type="text" name="cod_bar" id="cod_bar" value="introduceti codul de bare" onClick="if (document.product_form.cod_bar.value == 'introduceti codul de bare') {document.product_form.cod_bar.value='';}" onBlur="if (document.product_form.cod_bar.value == '') {document.product_form.cod_bar.value='introduceti codul de bare';}">
<input type="text" value="introduceti cantitatea" name="qty" onClick="if (document.product_form.qty.value == 'introduceti cantitatea') {document.product_form.qty.value='';}" onBlur="if (document.product_form.qty.value == '') {document.product_form.qty.value='introduceti cantitatea';}">
<input type="submit" value="Insereaza" name="add_product"   style="margin-left:5px; min-width:10px;">
<input type="submit" value="Cauta"  **class="fancybox fancybox.button"** name="search_product"  style="margin-left:5px; min-width:10px;">

</form>

In header I have something like this:

$(document).ready(function() {
$(".fancybox").fancybox({
    width       : 700,
    'height'    : 500,
    fitToView   : true,
    closeBtn    : true,
    autoSize    : false,
    closeClick  : true,
    openEffect  : 'elastic',
    closeEffect : 'elastic',
    'type': 'iframe',
    helpers : {
    overlay : {
    closeClick : true,
        css : {
            'background' : 'rgba(58, 42, 45, 0.3)'
        }
    }
}
});


});

I wanna add the fact that on a link like this : <a class="fancybox fancybox.button" href="something">bla</a> , fancybox works properly.Thanks!

Christophe
  • 4,798
  • 5
  • 41
  • 83

3 Answers3

0

if u want to use fancybox effect on submit button instead.

  <a  href=''></a> 

then include an onclick event on submit button and then call it. in your case you are not giving any location or image to be load in fancybox after click, so you need to also provide content that should load and display in fancybox.

Kevin B
  • 94,570
  • 16
  • 163
  • 180
Azam Alvi
  • 6,918
  • 8
  • 62
  • 89
0

Fancybox looks for the href attribute to load its resource. Your submit action does not have such an attribute. I am guessing you want to make it load the form action url? with the POST data? You will need to over ride the fancybox's beforeLoad method

$(".fancybox")
    .attr('rel', 'gallery')
    .fancybox({
        type: 'iframe',
        autoSize : false,
        beforeLoad : function() {                    
            this.width = parseInt(this.href.match(/width=[0-9]+/i)[0].replace('width=',''));  
            this.height = parseInt(this.href.match(/height=[0-9]+/i)[0].replace('height=',''));
        }
});

http://jsfiddle.net/BJNYr/

If you look here: http://fancyapps.com/fancybox/#docs

There is a href variable you can over ride.

You just need to decide what you want the fancybox to show exactly.

viperfx
  • 327
  • 5
  • 17