Go to Next page under the Same Record using submit button

Hi Tadabase,

I would like to ask if anyone can help me with the code. I’ve been working on this for 2 weeks now and I am unsuccessful. I am getting “/undefined” when I click the submit button, it suppose to go under the the same record.

What I want to achieve is that, I want to go to the “Add Job page” after clicking the submit button on the form on “Add Department page”.

Here is the code I used:

var setOnClickEventsForSubmitButton = function(){
    $('.submit-button').click(function(event){
        event.preventDefault();
        
        var recordId = $(this).parents('form').find('.recordId span').html();

        window.location.href = "/adding-referee/company/add-job/"+recordId;
    });
};

TB.render('component_6', function(data) {
    setOnClickEventsForSubmitButton();
    $('body').on('submit', '#recordForm', function(){
        setTimeout(function(){
            setOnClickEventsForSubmitButton();    
        }, 800);
    });
});

Hi Tadabase,

I try this code and it works:

var setOnClickEventsForSubmitButton = function(){
    $('.submit-button').click(function(event){
        event.preventDefault();
        
        var url = window.location.href;
    	var recordId = url.substring(url.lastIndexOf('/') + 1);


        window.location.href = "/adding-referee/company/add-job/"+recordId;
    });
};

TB.render('component_6', function(data) {
    setOnClickEventsForSubmitButton();
    $('body').on('submit', '#recordForm', function(){
        setTimeout(function(){
            setOnClickEventsForSubmitButton();    
        }, 800);
    });
});
1 Like