I am using joomla contact enhanced form component for my site. Now when I submit the form without the required field, the page is not scrolling back to the top rather it's stuck in the bottom section of the page. It would be great if anyone can help me out on this:

Now for required field, the following jquery code is applied:

_step : function(page,validate) {
        var status      = true;
        var validate    = validate || false;
        if(validate == true){
            $('#'+this.options.namespace+'-page-'+page).find('input[required],textarea[required],select[required]').each(function() {
                if(!$(this).valid()) {
                    status = false;

and I want to add scroll top functionality with an ID like the following:

            this.current = page;
            this.slider.accordion("activate", page);
            if (this.options.progressbar) {
                var value = page;
                if(this.options.progressbarLabel == 'text' || this.options.progressbarLabel == '%'){
                    value = page+1;
                this.progressbar.progressbar('value', value);
            $('html, body').animate({
                scrollTop: $('#ce-custom-fields-container').offset().top
            }, 1000);

            return true;
        return false;

So need your suggestion on how I am going to add required field with the scrolltop functionality?

  • Please don't just dump a load of unformatted jQuery. Only include relevant snippets
    – Lodder
    Jul 1 '15 at 17:50
  • 1
    Does the ID ce-custom-fields-container exist? Have you tried using console.log() to see if anything is coming back as undefined? Have you checked your browser console for any errors?
    – Lodder
    Jul 1 '15 at 19:52
  • @Lodder yes, that id is exist. There is no such error in browser console. I just want to add that id in required js code. The first paragraph where required code is there
    – indy
    Jul 1 '15 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.