10

Assuming your lightning:inputField tag has the aura:id of firstNameField, for example, you'd get its value with: var firstName = component.find("firstNameField").get("v.value"); In your second example, in your find call, you are using an uppercase A, whereas in your code the aura:id has a lowercase a: "myAtt" != "myatt" I've had some questions regarding ...


9

The focus appears to be set by a javascript method in bodyOnLoad() By providing my own definition of this function I can prevent the focus being set to the DateTime inputField. E.g. Add the following to your Visualforce page. <script>function setFocusOnLoad(){ /*NOOP*/ }</script> While this works I'm open to a better solution. Salesforce ...


8

Name is a read-only field that's basically FirstName and LastName concatenated. Try this with either of those fields, and make sure that the profile has Field Level access to those fields.


7

I think I found a solution using the $ObjectType global variable. <apex:inputfield value="{!sObjectMap[key][col]}" styleClass="type-{!$ObjectType.Custom_sObject__c.Fields[col].type}" /> This results in the type being added as a CSS class. Here's how a picklist renders: <select id="j_id0:j_id8:j_id15:0:j_id17:4:j_id23" class="type-...


7

Date is timezone non-aware, in fact, so is datetime (its stored at the server as GMT and re-rendered based on users TZ). Unless you hard-code a base time for your date in Apex code/Trigger, your going to want store a datetime value instead of a date. If you dont want the time part to show up, look into creating a formula field that renders the date based ...


7

The apex:inputField value u.contact must correspond to an SObject field. That is typically done by u being a reference to an SObject and contact being an SObject field name. For your example, that SObject field would be lookup field to Contact. apex:inputField requires meta data such as the field label that is only available from an SObject field; your ...


7

I think there are two issues: apex:inputField can only bind to an SObject field (as it takes the type and label from the field metadata) but you are trying to bind it to a String; use apex:inputText instead you have not provided get/set methods for OrderItem.test; one way to accomplish this is to change the code to initialise in the constructor and then use ...


6

The main issue is that immediate=true flag. When that's set, the action method is fired before the getters and setters. This is useful for things like cancelling, when you don't actually need to process anything. However, it's preventing the controller from getting your values. As you mentioned, removing this causes validation failures else where. You'...


6

<apex:inputField /> when bound to an sObject uses the field type that it is bound to in order to determine what type of HTML to render, including the label. If you are not interested in adding an sObject to the controller in order to provide binding for an inputField tag, your next options are: <apex:inputCheckbox /> <apex:inputFile /> &...


6

There is a Time Class in Apex that you can use. See my example below for how to get the current time displayed in the HTML 5 time input field Controller: public class MyTimeController { public Time myTime { get { if (myTime == null) { myTime = DateTime.now().time(); } return myTime; ...


6

Per Jeff Douglas's ROLL YOUR OWN SALESFORCE "LOOKUP" POPUP WINDOW blog post, one way to do this is to simply create a dummy instance of an object that has a relationship with the one you want to perform a lookup on, and then use the appropriate property of that instance as the value of an inputField. From his post: MyCustomLookupController Here's ...


6

There isn't one now, but it looks like one is coming in Summer 18. I just checked in my pre-release org and in v43.0 there is a new component called lightning:insertImageButton that can be used inside lightning:inputRichText <aura:component> <lightning:inputRichText value="<b>HELLO</b>"> <lightning:insertImageButton/&...


6

I guess you can add your lightning:recordEditForm inside the aura:if and reset the flag variable used in aura:if in insaveComplete() method .This will refresh the form.


6

You can pass the element id in the checkFileSize method, and then do your processing then <apex:page controller="FileUploadController"> <apex:inputFile id="inputfile" value="{!newAtt.body}" filename="{!newAtt.name}" onchange="checkFileSize(event,id)" /> <script> function checkFileSize(event , id ) { if(event.target....


6

event.target.values a string, not a date. You need to convert the value to date first then you need to subtract it. import { LightningElement, track } from 'lwc'; export default class LightningExampleInputDate extends LightningElement { @track date1; @track date2; @track result; datehandler1(event) { this.date1 = new Date(event....


5

In your VF page, use both components, inputField and outputField with opposite rendering condition. What you have to pay attention to is to update the components everytime an action specified in actionSupport is called. You can do so by wrapping both inputField and outputField components in an outputPanel and specifying the outputPanel's ID as the element to ...


5

Sorry I misunderstood you. here is a the right solution for your problem <apex:page standardController="Lead"> <apex:form> <apex:inputtext id="jsName"/> <script> var jsName = "{!$Component.jsName}"; </script> </apex:form> <script> window.onload=function() ...


5

I'm not sure how you want it to display, but how about using an <apex:repeat> with a map? Your class could look like this. public Map<String,Integer> vals { get { if (vals == null) { vals = new Map<String, Integer> { 'Value 1' => 0, 'Value 2' => 0, 'Value 3' =&...


5

There is something... I found this post Lightning - How to use force:inputField? and I'm validating this markup <force:inputField value="{!v.YourAttributeNameForTheSObject.YourFieldname}" /> It's in the documentation https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_force_inputField.htm The description is ...


5

You should not be setting Content-Encoding. UTF8 is for text, so it'll mess up some bytes in the upload process. Just leave that header out. Edit: I see you decided to base-64 encode your fileBody. Don't do that, either. Just use req.setBodyAsBlob(fileBlob); instead.


4

It is not a bug in apex:inputSecret. It happens with all non apex:inputField tags, including apex:text. See this post. The reasoning is that you can use whatever styling you want to indicate that it is required. For example, I have a Force.com Site where I specify that a field (using an apex:inputText) is required, but I use a red asterisk to indicate ...


4

You can of course use apex:inputText to retrieve data, but you lose the styling. Alternatively, you can use a temporary SObject instance created in Apex solely for the purpose of having the automatic styling. Then when the user clicks Save or whatever, transfer the temporary SObject data to the member vars you want them to reside in.


4

You can nest <apex:pageblocksection> elements with a columns="1" attribute to achieve this. <apex:pageBlockSection title="Product Information" columns="2" id="speditsect"> <!-- First Column Section --> <apex:pageblocksection columns="1"> <apex:inputField value="{!MyProduct__c.ProductName__c}" id="product_COL_A" ...


4

Okay, after some guidance from eyescream, I came up with the following: Using a suggestion found on this developerforce article and some off the wall advice. I came up with a decent but hacky solution. Using the document.getElementById function, I was able to pass parameters like so: In VisualForce <apex:inputField value="{!Task[TaskField]}" required="...


4

Salesforce has logged a bug for this issue and have posted this to the Salesforce Known Issues website https://success.salesforce.com/issues_view?id=a1p30000000T3CeAAK


4

I was having a similar issue with IE11. I had a Visualforce form, and sections of the page were re-rendered. In IE11, some empty tags were problematic. This included tags used for clearing and <apex:inputTextarea>. To correct the div, I inserted the html code for a space(&nbsp;). For example: <div class="clearer">&nbsp;</div> ...


4

See http://boards.developerforce.com/t5/Visualforce-Development/New-HTML5-Apex-Input-issue/m-p/698847#M70703. Fixed in next release. Thank you.


4

The value in the <apex:inputField> should always be associated with a field of a sobject. You could do something like this: <apex:component> <apex:attribute name="inputObject" type="sObject" description="Object Name"/> <apex:attribute name="inputFieldName" type="String" description="Field Name"/> <apex:inputField value=...


4

One way would be to create 2 separate validation rules so that you can apply the error to each field. So instead of the OR condition you would have 2 separate validation rules for each of the Dates.


4

No, you can't have a single Validation Rule attach messages to multiple fields. You would either need to make a separate Validation Rule for each field, or do the validation logic in a simple trigger and apply the messages to each field with record.fieldname.addError(String)


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