Please help! Problem with Custom form's Init_fields_v2()

Forums SPJS-Utility Please help! Problem with Custom form's Init_fields_v2()

This topic contains 3 replies, has 2 voices, and was last updated by  Alexander Bautz 2 years, 4 months ago.

  • Author
  • #16534

    Nan Duangnapa

    Hi Alex and all,

    I’m new to SPJS and need to implement exact solution for my site to display another list columns.

    I understand that I need 2 .js files;

    However, I also need to modify the init_fields()_v2 function in order for the demo code to work with my custom form site.
    Refer to

    Here is what I did
    1)I have replaced this function in my spjs-utility.js.

    function init_fields_v2(){
    var res = {};
    var thisID =;
    res[thisID] = $(this).parents(‘tr:first’);
    return res;

    2) I added custom Id to the ‘s formlabel which I only insert 1 place in my create new form.
    <td width=”190px” valign=”top” class=”ms-formlabel” id=”StatusCustomID”>

    3) I added the following to the CEWP in custom form site:

    fields = init_fields_v2();
    var myCompanyField = $(fields[‘StatusCustomID’]);

    I follow the rest of steps as arrFinAndDispName function.

    alert(myTitleField.html()) shows “undefined”
    Nothing display on my new form.

    Did I do anything wrong?
    Thank you so much


  • #16545

    Alexander Bautz

    I think you have mixed up the variables – you assign the value to “myCompanyField” but alerts “myTitleField”. Try alerting “” instead.

    If this don’t work, you can try using the developer console (hit F12 > Console) and type this in the console to see if the fields object contains your fields:


    Hit enter and look at the output.


  • #16547

    Nan Duangnapa

    Thank you so much Alex.

    I had fixed the code and the alert shows [object object]. Is it supposed to show this?

    Besides this, are my above steps correct? especially editing init_fields_V2() in spjs-unitilty.js while leaving the init_fields() function in the file?

    Thank you so much

  • #16674

    Alexander Bautz

    Sorry for the late reply. The alert [object object] means it is an object type an not a string. You can use console.log(PUT_VARIABLE_HERE) to see what the variable contains. Please note that you must have the developer console open (hit F12 > Console) to see the output.


You must be logged in to reply to this topic.