Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Power Apps Portals
Answered

Portals Javascript Changes you made may not be saved

(0) ShareShare
ReportReport
Posted on by 12

$(document).ready(function() {
$("#new_registrobool").change(onGuia);
$("#new_registrobool").change();

});

function onGuia(){
var valor = $("#new_registrobool").val();

if (valor == 100000002 )
{

$("#new_cantidadmaximadeparticipantesnum").closest("td").hide();
$("#new_cantidadmaximadeparticipantesnum").closest("td").hide();

$("#new_modalidadvirtualbool").closest("td").hide();
$("#new_presenciadeadulto").closest("td").hide();
$("#new_especifiquematerialesmtxt").closest("td").hide();
$("#new_objetivotxt").closest("td").hide();
$("#new_presenciadeadulto").closest("td").hide();
$("#new_modalidadvirtualbool").closest("td").hide();
$("#new_aclaracionescomentariosmtxt").closest("td").hide();
$("#new_minutosdeduracionnum").closest("td").hide();



}

}

 

Anyone know why?

 

Thx

  • Isr Profile Picture
    3 on at
    Re: Portals Javascript Changes you made may not be saved

    This helped. Thanks a lot.

  • Diego Botta Profile Picture
    12 on at
    Re: Portals Javascript Changes you made may not be saved

    Many thanks to both of you for sharing your solutions with me. We have achieved it. I still have a lot to learn.

  • Verified answer
    Fubar Profile Picture
    8,010 Super User 2025 Season 1 on at
    Re: Portals Javascript Changes you made may not be saved

    Usually the change detection for the Portal is based on a isdirty flag that is set when you change field values, but you may find that your code is triggering this via your .change() in the document.ready function.  Rather than triggering change() you should be able to just call onGuia() from that code snippet.

  • ragavanrajan Profile Picture
    7,036 Most Valuable Professional on at
    Re: Portals Javascript Changes you made may not be saved

    Hi @Dbotta ,

     

     May be try this approach instead of jQuery sometimes vanilla javascript works better.  I can see that you are trying to hide fields based on if certain condition is met. Your change detection in jQuery is making that popup. 

     

    This is a sample vanilla JavaScript. Please alter it according to your use.

     

     console.log("hiding fields");
     document.getElementById("new_modalidadvirtualbool").style.display = 'none';

    This is tested and working for me very well. 

     

    Give a try and hope it will solve your problem. 

     

    ------------

     

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Diego Botta Profile Picture
    12 on at
    Re: Portals Javascript Changes you made may not be saved

    thanks @ragavanrajan ,

     

    I checked where you say and the JS is working but it keeps insisting that I made some record change when I haven't and pop up a message if I want to cancel the action or I will lose everything. without javascript this does not happen

     

    js3.PNGjs2.PNG

  • ragavanrajan Profile Picture
    7,036 Most Valuable Professional on at
    Re: Portals Javascript Changes you made may not be saved

    Hi @Dbotta , 

     

    I have tested it using your same approach and it works fine. I believe it is not taking the changes due to Portal Language is different in your case. 

     

    To add your script  can you please try this approach using Portal management 

     

    1. Under content > Web pages  > Choose your web page (in this case Home page) 

    2.  Scroll down until you see Localized content > and then click the page again  

    3. Click Advanced and then under custom javascript section you can add your jQuery. 

     

    ragavanrajan_0-1611177905355.png

     

    4. Click Save and close 

    5. Now in your portal studio  > Please press the sync configuration and browse website. 

     

    Tip: In your jQuery add the console log to see your logging once you followed the above approach. 

    Hope it helps. 

    ------------

     

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Diego Botta Profile Picture
    12 on at
    Re: Portals Javascript Changes you made may not be saved

    Sorry, the translator omitted my introduction. I am using Portal and I am located in a form of the entity. The javascript I add it through the button that is shown in the interface and then options. 

    I don't know why without having made any changes it suggests that I will lose the changes when I exit. This only happens when javascript is in place (and does its job of hiding fields). The field that evaluates to trigger the action is a pick list

    JS.JPG

  • ragavanrajan Profile Picture
    7,036 Most Valuable Professional on at
    Re: Portals Javascript Changes you made may not be saved

    Hi @Dbotta , 

     

    Can you please tell us the scenario more specifically like where you have written this script ? Entity form / Web pages or in web files ? We can assist you more once we get clarity. Thanks 

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35