Keith Hudson

Forum Replies Created

Viewing 4 posts - 91 through 94 (of 94 total)
  • Author
    Posts
  • in reply to: Button as HTML that triggers a rule #9693
    Keith Hudson
    Participant

    David; you can trigger a rule from a button like this:

    <button type="button" onclick="spjs.dffs.triggerRule(['Append']);">Test</button>

    My ‘Append’ rule sets the value of Box_1 to “{Box_1} {Box_2}”.

    So, when Box_1 = “One fish” and Box_2 = “Two fish”, after pressing the button on my form, Box_2 = “One fish Two fish”.

    If you want to insert a line break when appending, your rule would look like this: {Box_1}\n{Box_2}

    Based on my testing, that will work for either plain text OR enhanced rich text fields.

    NOTE 1: DFFS is incompatible with Rich text fields, as far as I know.
    NOTE 2: I tested using the Dec 14, 2015 version of DFFS.

    in reply to: Adding "Save and Stay on Page" button in Edit form? #7477
    Keith Hudson
    Participant

    I succeeded in changing the onclick event of the Save button to save the record then post back to the edit form, BUT it seems that SharePoint 2013 handles multi-line text fields in some unusual way, because edits made to those fields did not get saved. Anyone attempting to add Save and Stay on Page functionality needs to test thoroughly that all fields are getting saved correctly before putting their solution into production.

    in reply to: Adding "Save and Stay on Page" button in Edit form? #7429
    Keith Hudson
    Participant

    I discovered that the approach I just posted saves SOME fields and not others, so its back to the drawing board.

    in reply to: Adding "Save and Stay on Page" button in Edit form? #7428
    Keith Hudson
    Participant

    I ran across this blog which gave me the headstart I needed: https://adrianhenke.wordpress.com/2010/08/19/custom-redirect-after-creating-a-new-sharepoint-item/

    The code I added to the JS Section of the Misc tab in the DFFS config of my Edit form is as follows:

    //this function renames the Save button to “Save and Stay on Page” and causes the save button to return to the same edit form it came from.

    $(document).ready(function() {
    var button = $(“input[id$=SaveItem]”);
    button.attr(“value”,”Save and Stay on Page”);
    // change redirection behavior
    button.removeAttr(“onclick”);
    button.click(function() {
    var elementName = $(this).attr(“name”);
    var aspForm = $(“form[id=aspnetForm]”);
    var oldPostbackUrl = aspForm.get(0).action;
    var newPostbackUrl = oldPostbackUrl + “&Source=” +oldPostbackUrl;
    if (!PreSaveItem()) return false;
    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, “”, true, “”, newPostbackUrl, false, true));
    });
    }); //end ready function

Viewing 4 posts - 91 through 94 (of 94 total)