Advertisement:

Author Topic: Contact publisher form  (Read 9518 times)

RajaSekar

  • Hero Member
  • *****
  • Posts: 791
  • ராஜசேகர்
Contact publisher form
« on: September 12, 2011, 07:47:12 pm »

Help us to change the contact publisher form to ajax contact form

thanks in advance

pman

  • Newbie
  • *
  • Posts: 47
Re: Contact publisher form
« Reply #1 on: September 13, 2011, 08:08:11 am »

RajaSekar

  • Hero Member
  • *****
  • Posts: 791
  • ராஜசேகர்
Re: Contact publisher form
« Reply #2 on: September 13, 2011, 02:44:06 pm »
Hi pman

I need to show contact publisher form into ajax form not a send to friend form.

Thanks in advance:-)

Juan Ramón

  • Osclass Developer
  • Hero Member
  • *****
  • Posts: 2382
Re: Contact publisher form
« Reply #3 on: September 13, 2011, 04:15:36 pm »
Well, it will be quite similar but changing the id of the serialize and a couple of things more.

RajaSekar

  • Hero Member
  • *****
  • Posts: 791
  • ராஜசேகர்
Re: Contact publisher form
« Reply #4 on: September 13, 2011, 04:21:04 pm »
Hi juan
Can you post the code

pman

  • Newbie
  • *
  • Posts: 47
Re: Contact publisher form
« Reply #5 on: September 14, 2011, 12:26:36 pm »
Edit your item.php file.

find form and add following to form code:

<form id="contact_form" ...  onsubmit="withoutRedirect();return false;">


Code: [Select]
<form ...>
</form>

<script type="text/javascript">
function withoutRedirect(){
    $.ajax({
        url: "<?php echo osc_base_url(true);?>",
        data: $("#contact_form").serialize(),
        context: document.body,
        success: function(res){
            var success = '<?php echo sprintf(_m('We just send your message to %s'), "" ); ?>';
            success = success.replace(/^\s*|\s*$/g,"");
            var RegularExpression  =  new RegExp(success);
                                   
            if( RegularExpression.test(res)){
                alert('send ok');
            }else{
                alert('NO send email');
            }
        },
        error: function(){
        }
    });
}
</script>

Quite similar, you see?

RajaSekar

  • Hero Member
  • *****
  • Posts: 791
  • ராஜசேகர்
Re: Contact publisher form
« Reply #6 on: September 14, 2011, 05:07:08 pm »

is not working

i want to show like the below image after clicking the Contact seller button


pman

  • Newbie
  • *
  • Posts: 47
Re: Contact publisher form
« Reply #7 on: September 14, 2011, 09:46:18 pm »
You need to learn jQuery. This is colorbox plugin. Possible, but consumes some time.

If you have a time to wait, I will try to help you, but only after finishing my plugin and few improvements in mobile theme.

computerbar

  • Tutor
  • Sr. Member
  • *
  • Posts: 279
Re: Contact publisher form
« Reply #8 on: September 15, 2011, 04:14:25 am »
Hi rajasekar

was it you asking the same question 2 years ago? :)
http://stackoverflow.com/questions/1328723/how-to-generate-a-simple-popup-using-jquery

I just did a quick test and it nearly worked..

RajaSekar

  • Hero Member
  • *****
  • Posts: 791
  • ராஜசேகர்
Re: Contact publisher form
« Reply #9 on: September 15, 2011, 04:34:23 pm »

Hi computerbar
I don't no how to implement the jquery code.
Can you provide a step by step guide.

RajaSekar

  • Hero Member
  • *****
  • Posts: 791
  • ராஜசேகர்
Re: Contact publisher form
« Reply #10 on: September 15, 2011, 06:19:55 pm »
I tried this code but it shows blank form

any one can help

Code: [Select]
<script type="text/javascript">
        $(document).ready(function() {
        $("#contact_form").fancybox({
                'width'                : '25%',
                'height'            : '60%',
                'autoScale'         : false,
                'transitionIn'        : 'none',
                'transitionOut'        : 'none',
                'type'                : 'iframe'
            });
 });
    </script>





computerbar

  • Tutor
  • Sr. Member
  • *
  • Posts: 279
Re: Contact publisher form
« Reply #11 on: September 16, 2011, 02:36:42 am »
you need to append the whole script in HEAD.php i.e in <head>...</head>
eg in your old thread as above on stackoverflow site

<script>
$(function() {
        $("#contact_form").live('click', function(event) {
            $(this).addClass("selected").parent().append('<div class="messagepop pop"><form method="post" id="new_message" action="/messages"><p><label for="email">Your email or name</label><input type="text" size="30" name="email" id="email" /></p><p><label for="body">Message</label><textarea rows="6" name="body" id="body" cols="35"></textarea></p><p><input type="submit" value="Send Message" name="commit" id="message_submit"/> or <a class="close" href="/">Cancel</a></p></form></div>');
            $(".pop").slideFadeToggle(function() {
                $("#email").focus();
            });
            return false;
        });

        $(".close").live('click', function() {
            $(".pop").slideFadeToggle(function() {
                $("#contact_form").removeClass("selected");
            });
            return false;
        });
    });

    $.fn.slideFadeToggle = function(easing, callback) {
        return this.animate({ opacity: 'toggle', height: 'toggle' }, "fast", easing, callback);
    };   
   </script>


Configure the form variables as like the contact publisher form on item page..

Call the above form anwhere on the page with
<a href="#" id="contact_form">Contact Form</a>



and obviously the CSS in your style.css
a.selected {
  background-color:#1F75CC;
  color:white;
  z-index:100;
}

.messagepop {
  background-color:#FFFFFF;
  border:1px solid #999999;
  cursor:default;
  display:none;
  margin-top: 15px;
  position:absolute;
  text-align:left;
  width:394px;
  z-index:50;
  padding: 25px 25px 20px;
}

label {
  display: block;
  margin-bottom: 3px;
  padding-left: 15px;
  text-indent: -15px;
}

.messagepop p, .messagepop.div {
  border-bottom: 1px solid #EFEFEF;
  margin: 8px 0;
  padding-bottom: 8px;
}

RajaSekar

  • Hero Member
  • *****
  • Posts: 791
  • ராஜசேகர்
Re: Contact publisher form
« Reply #12 on: September 16, 2011, 08:39:23 pm »

Hi iam interested in JQuery fancybox code

can you provide a JQuery fancybox code

Thanks for your help!




computerbar

  • Tutor
  • Sr. Member
  • *
  • Posts: 279
Re: Contact publisher form
« Reply #13 on: September 20, 2011, 07:03:46 pm »
Hello

I gave it try and I am getting the same blank page.

so far

See this error eg I remove the form from item.php and called item-contact.php direct with fancybox.

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="<br /> <b>Fatal error</b>: Call to undefined function osc_current_user_locale() in <b>/public_html/peeklocal.com/oc-content/themes/modern/item-contact.php</b> on line <b>24</b><br />

then I removed the above just to see what happens.
I got the next fatal error like undefined theme url.

will give another go when get home :) never fiddled with fancybox before.

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: Contact publisher form
« Reply #14 on: September 21, 2011, 08:31:56 pm »
Hi computerbar

Could you send me the code you are trying to get to showup in a fancybox? I may be able to help.

Jay