hi team,
below is my problem:
page having a button. Onclick of button one popup will get open and assign a value to hidden from popup on closing of pop up.
my problem is i have to read that hidden value and need to hide some design
when i write a code in click even of button first its checking hiddenvalue and later opening the pop up.
i want to check hidden value once pop up closed.
for ex: seen grid datasource done function like that any thing for button
kindly help me on this

Rajkiran SwainRank #165 · 14.4K reputationPosted Jun 20, 2023, 6:49 AM EDT
You can handle the closing event of the popup and perform the necessary actions to check the hidden value and hide the desired design elements. Here's a suggested approach:
In the button's OnSelect property, open the popup and pass the reference of the hidden control as a parameter. For example:
ShowPopup(EditForm1, { HiddenValue: HiddenControl }).In the popup's OnClose property, add a formula to handle the closing event. Inside this formula, you can check the value of the hidden control and hide the necessary design elements accordingly. For example:
OnClose: If(HiddenValue.Value = "some value", Set(DesignVisible, false), Set(DesignVisible, true) )In the above formula,
HiddenValueis the reference to the hidden control, andDesignVisibleis a variable used to control the visibility of the design elements you want to hide or show.DesignVisiblevariable. For example:Visible = DesignVisible.By handling the closing event of the popup, you can ensure that the hidden value is checked and the necessary design elements are hidden or shown accordingly. Adjust the code according to your specific requirements and control names.
Deepak RawatRank #646 · 3.7K reputationPosted Jun 20, 2023, 7:38 AM EDT
You can try Html and java script if needed.
document.getElementById("openPopupButton").addEventListener("click", function() { var hiddenValue = document.getElementById("hiddenValue").value; if (hiddenValue === "your-condition") { // Open the popup openPopup(); } else { // Wait for the popup to close and perform the action var popup = openPopup(); popup.onclose = function() { // Read the updated value of the hidden input var updatedHiddenValue = document.getElementById("hiddenValue").value; // Perform action based on the updated hidden value if (updatedHiddenValue === "your-condition") { // Hide the design or perform any other action hideDesign(); } }; } }); function openPopup() { // Code to open the popup } function hideDesign() { // Code to hide the design }Murali PRank #6,159 · 275 reputationPosted Jun 20, 2023, 9:54 AM EDT
@Deepak..
Thanks a lot for ur help.
but am facing the below error.
Uncaught TypeError: Cannot read properties of undefined (reading 'close')
Brahma Prakash ShuklaRank #633 · 3.8K reputationPosted Jun 23, 2023, 1:48 AM EDT
Hi @Murali, To achieve the desired behavior, you can use a combination of event handlers and callback functions. Here's an example:
// Define a variable to store the hidden value var hiddenValue = null; // Event handler for the button click $("#button").on("click", function() { // Check the hidden value before opening the popup if (hiddenValue !== null) { // Call a function to handle the hidden value and hide the design handleHiddenValue(hiddenValue); } // Open the popup and assign the value to the hidden field openPopup(function(value) { hiddenValue = value; }); }); // Function to handle the hidden value and hide the design function handleHiddenValue(value) { // Your code to hide the design based on the hidden value // ... } // Function to open the popup and execute a callback on closing function openPopup(callback) { // Your code to open the popup // Example code for simulating the closing of the popup and assigning a value setTimeout(function() { var popupValue = "some value"; // Assign the value to the hidden field // Call the callback function with the assigned value callback(popupValue); }, 2000); // Replace this with your actual code to close the popup }In the example above, when the button is clicked, it first checks if the hidden value is already assigned. If it is, the
handleHiddenValue()function is called to handle the value and hide the design accordingly. Then, theopenPopup()function is called, which simulates the opening of a popup. Upon closing the popup, a callback function is executed, where the hidden value is assigned and stored in thehiddenValuevariable.