Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to save HTML Form in web resource on submit button

Posted on by Microsoft Employee

Screenshot-_2800_211_2900_.png

*This post is locked for comments

  • Suggested answer
    Dan Hesketh Profile Picture
    Dan Hesketh on at
    RE: How to save HTML Form in web resource on submit button

    Hi mate,

    If I understand you correctly, you probably want to SAVE the data entered into your HTML form onSave.

    Also if the form is re-opened later, you'd want the Form to re-populate with the existing data.

    I have applied a similar technique before and I believe the best approach is as follows:

    This is high-level:

    1. Create a Multi-Line Text Field on your CRM Form (it can be hidden) to store the data

    2. Code your HTML form fields so that each <input> field etc calls your function eg. "saveItem()"

        This function will need to generate the entire form data (all fields) into a JSON Array

        and store it in the Multi-Line Text field above, overwriting anything there already.

    3. Setup your HTML to be "dynamic" in that onLoad it reads existing data from the JSON Array and populates the form again.

    A quick search surfaced this post from the amazing Paul Nieuwelaar @ Magnetism NZ. He goes into much more detail than me here. Different scenario, but same approach.

    http://www.magnetismsolutions.com/blog/paulnieuwelaar/2015/08/25/basic-html-rich-text-editor-for-microsoft-dynamics-crm-2015

    Hope this gives you some great ideas.

    P.S. I have a solution/app that uses similar techniques but for a Checklist/To-Do List.

    You can check it out on AppSource shortly, or www.miiia.com.au/add-ons

    Cheers,

    Dan

  • Suggested answer
    RE: How to save HTML Form in web resource on submit button

    Hi Afroz,

    You need to elaborate your query to get approprate answer.

    Is that your requirement is to call function that sits in your HTML webresource when user saves CRM form? If yes,

    You need to create a function in your HTML webresource lets name the function as "SaveRegistrationInfo".

    New create a JavaScript webresource with a function "Form_OnSave" and then add this webresource to your registration Form and call "Form_OnSave" function on save of the form.

    function Form_OnSave()

    {

    Xrm.Page.getControl("WebResource_<HTML Webresource name>").getObject().contentWindow.window.SaveRegistrationInfo();

    }

    Hope this works!

    Regards,

    Surender Vishwanatham

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans