Hot answers tagged

6

Yes, you can. You can use the onclick attribute like below. <apex:commandButton value="Search" action="{!objectCollection}" onclick="callJSFunc()" style="margin-left:10px" reRender="source_search"> <apex:param name="source" value="true"/> <apex:param name="target" value="false"/> </apex:commandButton> UPDATE Based on ...


6

In this case, it was a simple typo: the ID value is cAsE-sEnSiTiVe. alert('called' + document.getElementById("thepage:theform:atextId").value); // ^ This P was capitalized Always make sure you're matching the case for your Id values. As a more practical solution, consider using $Component: alert('...


5

It would look something like this: {!requireScript("/soap/ajax/37.0/connection.js")} var newRecords = []; var c = new sforce.SObject("Invoice_Statement__c"); c.id = "{!Invoice_Statement__c.Id}"; c.Contract_Date__c = new Date("{!Invoice_Statement__c.Contract_Date__c+365}"); newRecords.push(c); result = sforce.connection.update(newRecords); window....


4

So when you create the script and use the binding the value of the binding is the what it was when the page loads. If all you wanted to do was redirect to the new case (without a message) that is easy: Create an actionFunction that does this: <apex:actionFunction name="gotoCase" action="{!gotoCase}" rerender="msgs"/> then code public ...


4

Change your javascript function name from new() to something else say new_method() as new is a keyword. It will work.


4

The problem is reported in the console: Uncaught TypeError: checked is not a function It seems to be a name conflict but I can't see where. Changing the function name to e.g. isChecked works around the problem. PS The fix that relates to the root cause is this: <apex:inputcheckbox onclick="window.checked()"/> that references the global ...


4

The first thing you should always do when you face a Javascript error is open up the console. Here's how to do it on: Chrome Firefox Opera Safari IE If you had done so, you would have seen the following error when you click the checkbox: Uncaught TypeError: checked is not a function There are a few ways to deal with this. My preference is to use ...


4

There is no exact and simple solution for this OK and CANCEL in Confirm Popup using javascript. But you can do this with the help of JQUERY. Try the below link to understand better... https://stackoverflow.com/questions/823790/javascript-confirm-popup-yes-no-button-instead-of-ok-and-cancel Update: Open jQuery Dialog from Custom Button https://success....


4

Caution This code relies on the internal library, and so may break at any time. Use at your own risk. Basically, you can override the default method, which will allow you to do something based on the twist happening. There's no official "event" which occurs, as it's just Vanilla JS that's running here. Here's a proof of concept: <apex:page> <...


4

Add an aura:id to the <ui:button /> component, then find the button by it. component: <ui:button aura:id="btn" label="A" press="{!c.disableMe}"/> <ui:button aura:id="btn" label="B" press="{!c.disableMe}"/> <ui:button aura:id="btn" label="Enable them all!!!" press="{!c.myClearButtonClicked}"/> ...


4

When you're using normal HTML, you have a lot of flexibility in what you do with this. One solution not involving the use of id is to set a data attribute on the span: <aura:component> <aura:attribute name="numberList" type="Object[]" access="private"/> <aura:iteration items="{!v.numberList}" var="obj"> <span data-num="{!...


3

This functionality works for me. If I include the below Visualforce Page in a Page Layout and click the button, it refreshes the whole page. <apex:page standardController="Case"> <apex:form> <apex:commandButton value="Reload" onclick="window.location.top.reload();" /> </apex:form> </apex:page> That implies the ...


3

update your query : sforce.connection.query("SELECT Id, Is_Picked__c,Last_Seen_By__c FROM Lead WHERE Id =\'"+records[0]+"\' LIMIT 1");


3

Please create a Custom button on the Object where you want to show all records and below is the Code for the custom button: {!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")} // Quering the database and Example Query and you can modify it as per your requirement var result = sforce.connection.query("Select ID From Opportunity"); // Getting all records ...


3

That's because you cannot have multiline strings in Javascript unless they are properly escaped. Try JSENCODE on the string: dog.colMrk__c = "{! JSENCODE(Birth_Record__c.Characteristics__c) }"; JSENCODE documentation can be found here.


3

Replace: var currentProjectPhase = {!project_cloud__Project__c.Current_Project_Phase__c}; With: var currentProjectPhase = "{!project_cloud__Project__c.Current_Project_Phase__c}"; Also: if (currentProjectPhase !== undefined) will never return false because once you declared 'var currentProjectPhase' it will never be 'undefined'. So replace it with: ...


3

If you want to abort the action, return a value. If you do not want to abort the action, do not return a value. Example: <apex:commandButton value="Do Something" onclick="if(!confirm('Are you sure?')) return false;" /> Replace "confirm" with your custom logic, this was a simple copy-paste example to get you started. To modify ...


3

I just did something like this the other day. Not sure if it meets all your needs but it at least illustrates the concept Component Controller ({ doinit: function(component,event,helper){ <iframe name="pc-frame" src="{!v.iframe-url}" style="width: 100%;height: 770px; border: none;" scrolling="true"/> $A.createComponent( "aura:...


3

The following works in my testing: <apex:commandButton value="Reject (Entry Criteria)" onclick="if(!confirm('Are you sure?')){return false};" action="{!debugSomething}" oncomplete="refreshPage();" /> From the linked duplicate: onclick="return confirm('Are you sure?');" is always returning before calling the code to the controller method. What I ...


3

In my case I was missing the exclamation point in action in the component definition: incorrect: onclick = "{ c.someEvent }" correct: onclick = "{! c.someEvent}"


3

You forgot the quotes on the outside: var encoded = "{!JSENCODE("St. John's")}"; This would render as: var encoded = "\"St. John\'s\"";


2

Following code might help in updating a checkbox for that record. {!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} var newRecords = []; var obj = new sforce.SObject("ObjectName"); obj.id ="{!ObjectName.Id}"; obj.Custom_Checkbox_API_Name__c = true; newRecords.push(c); result = sforce.connection.update(newRecords); --- Send Email along with this ...


2

SFDC_BigDog, please enable the apex class access and visualforce pages access for that profile and check it again. Setup->manageusers->profiles->scroll down and give acces to that particular pages and classes. let me know if this helps and mark it as best answer.


2

I got and answer on that.. i have used $("form").submit(function( event ) { event.preventDefault(); url = $form.attr( 'action' ); var posting = $.post( url, { email: $('#email').val() } ); posting.done(function( data ) { alert("success") }); ...


2

Looks like in your javascript you've missed {! } when referencing Form_Requests_abv__c.id Try this one: var query = "SELECT Account_abv__c ,Address_abv__c,Form_Request_abv__c, OwnerID, Quantity_abv__c, Product_abv__c, Form_template_abv__c, Id FROM Sample_Order_Form_abv__c WHERE Form_Request_abv__c= '" + {!Form_Requests_abv__c.Id} + "'";


2

Simple way use for attribute of apex:ouputlabel and pass the id <apex:outputLabel value="Checkbox" for="theCheckbox"/> <apex:inputCheckbox value="{!inputValue}" id="theCheckbox"/> Let me know if this solved your problem or not


2

The input to the webservice is passed as a serialized JSON string. You need to accept a string as input to the webservice method and deserialize it in the method. So the definition of the webservice would be: webservice static void sendMails(String newrequests){ To get the list, you would do this: List<Form_Requests_abv__c> = (List<...


2

Your condition: if(!("{!Animal__c.RecordType}" != "2 – Invoice" || "{!Animal__c.Invoice_Status__c}" != "Credited")) will be executed only if condition inside parenthesis is false, meaning that both comparison should be false. e.g. RecordType == "2- invoice" and status == "Credited" This can be replaced with: if(("{!Animal__c.RecordType}" = "2 – ...


2

Give your apex:param name attribute. So it will work. <apex:actionFunction name="callAF" action="{!checkActive}" reRender="pbt"> <apex:param name="apparam" id="accId" value="" assignTo="{!recordId}"/> </apex:actionFunction> This will not give you compile time error but name is the required attribute of apex:param tag


2

Can you please try below code, if the check value is coming as true from check=sforce.apex.execute("CheckAOCAccess","AOCAccess",{LoggedUser:"{!User.Id}"}); if(check=='true'){ // This line fails to work based on check value alert('check@1'+check); window.open(vUrl); } else {//Everytime else block is fired alert('You are have not the privilege for ...


Only top voted, non community-wiki answers of a minimum length are eligible