cforms II User Forum

Registration is currently disabled.
Guest

FAQs

Login form protected by Login LockDown.


Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS Related Topics
Using Cforms in a lightbox in Wordpress, and page refreshes on submit, closing the lightbox.
August 1, 2011
11:11 pm
Jessica
Guest

Hello! I'm using cforms inside of a lightbox. Is there a way to keep it from refreshing the page when the submit button is clicked? This closes the lightbox, and you can't see the success/error message. I have Ajax enabled in the CMS. I'm just using a very basic version of a jquery lightbox. Here's my code. Thanks!

 

    <script type="text/javascript">
     $(document).ready(function(){
     $("#show-panel").click(function(){
     $("#lightbox, #lightbox-panel").fadeIn(300);
     })
     $("#close-panel").click(function(){
     $("#lightbox, #lightbox-panel").fadeOut(300);
     })
     })
    </script>   

        <div id="show-panel">CONTACT US</div>
        <div id="lightbox-panel" class="contactlightbox">
        <?php insert_cform(1);?>
        <p style="float: left;">*Required fields</p>
        <p align="center">
        <div id="close-panel">X</div>
        </p>
        </div><!-- /lightbox-panel -->

        <div id="lightbox"> </div><!-- /lightbox -->

August 2, 2011
7:36 pm
Jessica
Guest

Anyone have any ideas?? Please, any and all help would be greatly appreciated.

August 2, 2011
9:18 pm
Jessica
Guest

I just had to implement a work around of types.. so people will get an alert message if they don't enter all of the required information, and when they submit the form. Here's the code incase anyone else is having this problem and they need a hacked work around..

 

$(document).ready(function(){

        function isEmail (emailentry) {
                var isEmail_re       = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/;
                   return String(emailentry).search(isEmail_re);
                }
        var name = "";
        var email = "";
        var message = "";
        
        
        
        $('#sendbutton').click(function(){
            name = ($('#cf_field_2').val());
            email = ($('#cf_field_3').val());
            message = ($('#cf_field_4').val());
            
            
            if( isEmail(email) == -1){
                    alert('Please enter a valid E-mail address');
                return false;
                }else if (name!="" && email!="" && message!=""){
                    alert('Thank you for submitting your message!');
                }else{
                    alert('Please fill in all the required fields');
                return false;
                }

        
            });

            
    
});

October 15, 2013
9:22 pm
Glitch
Guest

I'm running into the same issue but the hacked work-around isnt all that nice. Did someone ever find a proper solution for this?

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
38 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3734

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5335

Posts: 18699

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)