$(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
Solved! Go to Solution.
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.
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
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
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.
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.
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
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.
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.
Many thanks to both of you for sharing your solutions with me. We have achieved it. I still have a lot to learn.
User | Count |
---|---|
9 | |
7 | |
6 | |
4 | |
2 |
User | Count |
---|---|
20 | |
18 | |
16 | |
13 | |
4 |