Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Javascript to update subform

Locked
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Javascript to update subform

Unread post by ruiascensao »

Hi ,

I have a form that when user updates the status it should insert a new line in the Jobhistory_subform.

Code: Select all

function updatehisto() {
    //Place the field data-prefixe that are marked for deletion in an array.
    var subFormPrefixes = nuSubformArray('jobhistory_subform', true);
//Update the job status
    var newValue = $('#jobstatuschange').val();
    $('#job_status').val(newValue);
//Place a new line in the subform "jobhistory_subform" .
    for( var index in subFormPrefixes) {
        if($('#'+subFormPrefixes[index]+'jobhistory_visaid').val()==' '){
           $('#'+subFormPrefixes[index]).checked=false;
           $('#'+subFormPrefixes[index]+'jobhistory_visaid').val(newValue);
 }
} 
nuSaveForm();
}
At the moment I'm able to "//Update the job status" but I'm not able to "//Place a new line in the subform "jobhistory_subform" ."

Could you please advise?
BR
Rui
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Javascript to update subform

Unread post by admin »

rui,

How about this?

In the lastest build I have added a function nuAddRow(subformname) that should help.

Steven
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: Javascript to update subform

Unread post by ruiascensao »

Hi Steven,

Thanks!
BR
Rui
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Javascript to update subform

Unread post by admin »

.
Locked