Nothing happened when trying to use SPCascadeDropDown in a New created form . It works fine using NewForm.aspx and EditForm.asps

Dec 8, 2014 at 9:07 AM
Hi All,

I 'm a new sharepoint developer ( 1 month ). For a project, i found the very useful SPCascadeDropDown function in SPServices which worked when inserting to NewForm.aspx and EditForm.aspx. But when i created a new Form (for a better look and feel) and inserted the code in my new form, nothing happened. Maybe i missed something .

Is there a specific settings to add in my new form to make the code work ? Is it possible in a new form ?

I will appreciate any comments, ideas, work around for the abovee.

Many thanks in advance

Fred
Coordinator
Dec 8, 2014 at 2:45 PM
Fred:

You've said that SPServices is working in a NewForm but not in a new form. I'm not sure what you mean. If you've created an InfoPath form or a fully customized form the DOM is different, so SPServices won't understand it.

M.
Dec 8, 2014 at 5:08 PM
Thanks for the reply. This is a new form i created from a list using SP Designer : insted of having a listformwebpart, i have a dataformwebpart. I'm sure you are right this is because the DOm is different. However, how could i make it run ?
Thanks
Fred


-----"sympmarc" <[email removed]> a écrit : -----
A : [email removed]
De : "sympmarc" <[email removed]>
Date : 08/12/2014 15:46
Objet : Re: Nothing happened when trying to use SPCascadeDropDown in a New created form . It works fine using... [SPServices:574314]

-->

From: sympmarc

Fred:

You've said that SPServices is working in a NewForm but not in a new form. I'm not sure what you mean. If you've created an InfoPath form or a fully customized form the DOM is different, so SPServices won't understand it.

M.


CONFIDENTIALITY NOTICE AND DISCLAIMER
This message, including any attachments, contains confidential information which may also be privileged or otherwise protected by work product immunity or other legal rules. It is intended solely for the use of the individual or entity to whom they are addressed. If you have received this message in error, please notify the sender and remove it from your system. Any unauthorized review, disclosure, copying, distribution or use of this information is strictly prohibited. The Company accepts no liability for the content of this email or for the consequences of any actions taken on the basis of the information it contains.

Vesuvius France SA, 68 Rue Paul Deudon, 59750 Feignies, France, www.vesuvius.com
Coordinator
Dec 8, 2014 at 8:00 PM
It really depends on how customized the form is. SPCascadeDropdowns looks for elements in the page matching the parameters you've given it. You can have problems for many reasons, like the elements not being dropdowns, the underlying markup being different, the ids of elements being different, etc.

I used to customize forms a lot and then I realized I could usually accomplish what I wanted with just CSS and script. I just move things around in the DOM with the script to make the page look different.

M.
Aug 18, 2015 at 4:07 PM
Hi Marc,

I'm experiecing the same problem. In my case, i have used SP Designer's Create New List Form and generated a new form. The customisations i have done is to remove few unwanted fields that i wanted not to display. The rest remains the same.

Then, i have included SPCascadeDropDown function and it doesn't trigger any changes on both dropdowns. However, the same code is working fine when i have created it in a default newform.aspx pages....

Thanks
Sunil
Aug 18, 2015 at 6:06 PM
Hi Marc,

After doing some debugging, i have found that the ParentColumn.Obj.html() returns null in the custom newform created whereas it returns the proper innerHTML of the SELECT control when the form is a default newform.aspx.

Looks like there is an issue of how the Sharepoint renders the controls and below code from your script is unable to identify either the parent or child control.

function findFormField(columnName) {
    var thisFormBody;
    // There's no easy way to find one of these columns; we'll look for the comment with the columnName
    var searchText = RegExp("FieldName=\"" + columnName.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") + "\"", "gi");
    alert(searchText);
    // Loop through all of the ms-formbody table cells
    $("td.ms-formbody, td.ms-formbodysurvey").each(function () {
        // Check for the right comment
        if (searchText.test($(this).html())) {
            thisFormBody = $(this);
            // Found it, so we're done
            return false;
        }
    });
    alert(thisFormBody);
    return thisFormBody;
} // End of function findFormField
Do you have any idea how i can fix this?

Thanks
Sunil