Who has never been tempted to use

content control

in their application? Control which allows to add an iframe in a form, allowing to insert a 2nd form inside the first one.

Several advantages:

  • Pass a parameter of the parent form to display data
  • To be able to change the content of a part of a form without reloading the complete page

Once in place, arrives the famous problematic: “Thin, how to call a rule present in the form contained in my

content control

?”  🙄

The solution is quite simple, you have to go through JavaScript to set up this mechanism:

  • In the form in the content control:
function SaveData() {
$('#00000000-0000-0000-0000-000000000000_e9f68a84-dafc-4dd8-b32f-27397cfe33e8').click(); 
}

This function

JavaScript

will be called by the parent form, the ID contained in my example (00000000-0000-0000-0000-000000000000_e9f68a84-dafc-4dd8-b32f-27397cfe33e8) is the ID of the button I want to call. To find these IDs, it’s easy, launch the form and use the F12 function to locate the button and retrieve its identifier.
😎 Tip: It will not change when you change environment.

  • In the parent form:
$(".content-control-iframe")[0].contentWindow.SaveData();

Mind you, the parent form can not know that the rule executed in the child form is complete, so be careful about expensive queries in time of execution to not close the form too quickly.

 

It’s your turn 😉

Leave a Reply

Your email address will not be published.