2

I have created one aspx page for implementing the edit comments of the form. For this I am using the SharePoint InputFormTextBox control. I have a total of 4 Divs each containing one InputFormTextBox, 2 hiddenfields and 3 buttons. Sample code of one div is shown below.

<div id="p0">        
    <asp:HiddenField ID="hSectionNamep0" runat="server" Value="Statement" />
    <asp:Button ID="btnUpp0" runat="server" Text="Up" OnClientClick="moveDiv('p0', 'up');  return false;" />&nbsp;
    <asp:Button ID="btnDownp0" runat="server" Text="Down" OnClientClick="moveDiv('p0', 'down');  return false;" />&nbsp;
    <asp:Button ID="btnDeletep0" runat="server" Text="Delete" OnClientClick="removeDiv('p0');  return false;" />&nbsp;
    <SharePoint:InputFormTextBox ID="Editor0" runat="server" Font-Names="verdana,arial,helvetica,sans-serif"
        Rows="10" RichTextMode="FullHtml" TextMode="MultiLine" RichText="true" CssClass="ms-rtelong">
    </SharePoint:InputFormTextBox>
    <asp:HiddenField ID="hdnp0" runat="server" Value="0" />
</div>

These same controls with different names are placed inside 3 other divs followed by the above div.

For changing the position, I am using this jquery method.

function moveDiv(id, direction) {

    var previous = getPrevDiv(id);
    var next = getNextDiv(id);

    if (direction == "up") {
        $("#" + previous.id).insertAfter("#" + id); 

    }
    else if (direction == "down") {

        $("#" + id).insertAfter("#" + next.id);
        }


    refreshButtons();


}

The getPrevDiv() and getNextDiv() as follows.

function getPrevDiv(id) {
    var children = $('#editors').children();
    if (children[0].id == id) {
        return null;
    }

    for (i in children) {
        if (children[i].id == id) {
            return children[i - 1];
        }
    }
}
function getNextDiv(id) {
    var children = $('#editors').children();

    for (var i = 0; i < children.length - 1; i++) {
        if (children[i].id == id) {
            return children[i + 1];
        }
    }

    return null;
}

All the positions of these Divs are changing correctly. But unfortunately, one extra InputFormTextBox with disabled toolbar is showing just below of the orginal control. While debugging the solution I am getting this error.

Microsoft JScript runtime error: Unable to set value of the property 'designMode': object is null or undefined

followed by some other error related with this same control. Please help me to resolve this issue.

Thanks in advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.