• ksmo
  • NEWBIE
  • 40 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 8
    Replies
I have a button update as below

<apex:commandButton id="UpdateButton" value="UPDATE" styleClass="UpdateButton" onclick="CheckAcceptOnUpdate()" action="{!doSave}"/>

on the apex class the do save does the update to the database perfectly.

But now I want that update to work only if accept checkbox is checked so I have written the onclick function

function CheckAcceptOnUpdate()
{


var accept = document.getElementById('{!$Component.formterm.terms}').checked;


  if(accept==false)
  {
  
  alert("please accept terms");
  
  
  }

}

The popup is working as expected and it is not preventing the update function.the action dosave is being called. If the accept checkbox is not checked, it should only show the pop up and do nothing else.

 
how can we fetch the value of custom object values to visualforce page input fields
I want the dialog popup to display only when the checkbox is checked, but this code displys when checked and unchecked. I want a different pop up for uncheck..How do I write that script?
checkbox code
<input id="showprompt" type="checkbox" name="CO_BRAND" value="cobrand"  onclick="ShowPrompt()" /> 

Javascript Code

<script>
    
var checkmodal = document.getElementById('checkboxModal');
var btn = document.getElementById("showprompt");
var span = document.getElementsByClassName("checkboxclose")[0];


function ShowPrompt()

{
  checkmodal.style.display = "block";
  
}

span.onclick = function() {
    checkmodal.style.display = "none";
}

window.onclick = function(event) {
    if (event.target == modal) {
        checkmodal.style.display = "none";
    }
}
I have a text box and few checkboxes on the page. If the user enters,changes existing text,clciks or unclicks the checkbox and clicks the cancel button or navigates away from the page I want a pop-up message saying yor changes have not been saved
Hi,

I have a button which is a div element. The css for this button is that it is grey in color.

<div class="UpdateButton"> UPDATE </div> 
When text is inputted in the text box the color of the button should change to red.
<div class="textpanel"> <input type="text" size="35" /><br/></div>

Similrly ther eis a checkbox on visualforce componenet which is referenced on the visualforce page. If that checkbox is checked the button should change to red.
hi all,

i have a requirement where in i want to alert a user whenever the user navigates away from the webpage without clicking on save button and navigating away instead of that..i tried the below code but its not working..
below is my code

 
<apex:page controller="VistAudit_VFC" action="{!createData}">
<body onload="myfunction()">
<script>
function myFunction()
{
alert("Are you sure you want to navigate away?");
}
</script>

     <apex:form >
  <apex:outputLabel value="Audit Visit" style="font-family:Times New Roman;font-size:18px"></apex:outputLabel><br></br>
 
    <div align="center" draggable="false" >
    <apex:commandButton value="Save" action="{!save}" onclick="myFunction();"/>
    </div>
..........
...........
.......
</apex:form>
</body>
</apex:page>

Can anyone please suggest as to how can i correct my code?


thanks,
 

Hi,

 

I have seen in many examples but donot know when and in which situation should we use <apex;repeat> within <apex:variable>.

 

CAn some one understand me with example?

 

 

 

 

.