Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8238219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:44:10+00:00 2026-06-07T19:44:10+00:00

function dadosFormularios() { var dadosFormulario = {}; var iterador = countForms; var i =

  • 0
function dadosFormularios() {
    var dadosFormulario = {};
    var iterador = countForms;
    var i = 0;
    while (i < iterador) {
        dadosFormulario[i] = {};
        dadosFormulario[i]['a'] = $('#field\\[' + i + '\\]\\[a\\]').val();
        dadosFormulario[i]['b'] = $('#field\\[' + i + '\\]\\[b\\]').val();
        //alert(dadosFormulario[i]['a']);
        //alert(dadosFormulario[i]['b']);   
        i++;
    }
    var qstring = '';
    var tmp_qstring = [];
    var temp1, temp2;
    var aux_i = i + 1;
    alert(aux_i);
    for (var j = 0; j < aux_i; j++) {
        temp1 = dadosFormulario[j]['a'];
        alert(temp1);
        temp2 = dadosFormulario[j]['b'];
        //alert(temp1);
        tmp_qstring[j] = 'a' + j + '=' + temp1 + '&' + 'b' + j + '=' + temp2;
    }
    qstring = tmp_qstring.join('&');
    alert(qstring);
    window.location = 'dup1.php?' + qstring;
}

When i click on a button i call the above function and now I’m trying to send the data of the array of objects to another page as you can see in the code.

My problem is that i’m getting trouble when i set dadosFormulario[j]['a']; or dadosFormulario[j]['b']; to a var or set them directly in the tmp_qstring i.e. tmp_qstring[j]=dadosFormulario[j]['b'];. In chrome console i get the error:

Uncaught TypeError: Cannot read property ‘a’ of undefined

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:44:12+00:00Added an answer on June 7, 2026 at 7:44 pm

    Fix your loop to use:

    j < i
    

    Because both your array and your iterator variable j are zero-based. You have to stop iteration when your iterator reaches array length – 1 (i is the length in your case). This is typically the case for for loops over the length of an array.

    If you iterate until j <= i your iteration index will go out of the end bound of the array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function dowork() { $(.wrappedElement).removeClass(wrappedElement); $(.wrappedElementout).removeClass(wrappedElementout); var a=$(div#DepPart select option:selected).val(); $(div#TestPart select option[value^=a]).addClass(wrappedElement); $(div#TestPart select
function logsig() { var username = $(#username).val(); var password = $(#password).val(); var dataString =
function ff_chk_username_unique(element, action) { alert(element.value); alert(action); var actiona=http://localhost/myproject/check/check_username.php; var form_data = { username: element.value,
function something(frm,i){ //var ch=frm.outof1.value; for(var j=1;j<=i;j++) { //var b=outof + j; alert(frm.outof+j.value); } //alert(outof
function Apple(){ this.name=apple; } function Orange(){ this.name=orange; this.apple = new Apple(); this.apple.onCalled=function(){ alert(this.name); }
function checkuser(user) { var ret = false; $.ajax({ type:'POST', url:'user.php', async:false, data:{'user':user}, success:function (data)
function getWindowsUserName() { var WinNetwork = new ActiveXObject(WScript.Network); var urlToSite = http://localhost/index.php?nph-psf=0&HOSTID=AD&ALIAS= + WinNetwork.UserName;
function getWindowsUserName() { var WinNetwork = new ActiveXObject(WScript.Network); var urlToSite = createCustomURL(WinNetwork.UserName); document.getElementById(psyncLink).src =
function getUser() { FB.api('/me', function(response) { console.log('Response is '+response); alert('Your name is ' +
function getDbValue() { alert($('[data-bind]').length); alert($('[data-bind][0].data-bind')); alert($('[data-bind][0].value')); jQuery.each($('[data-bind]'), function(databind,key) { alert(key); alert(databind); alert(databind[key].data-bind); }) }

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.