I am new to salesforce and Apex . In apex:input field i have use html-maxlength it is working fine but in IE11 it is showing message on submit button .
Please suggest how can i find thi css Class or how can i change it style
<apex:inputField id="phonePrimary" value="{!primaryContact.Phone_Number__c}" onKeyDown="isNumberOnlyForPrimary(event);" onKeyUp="formatPrimaryPhoneNumber(event);" styleClass="form-control phonePrimary" html-maxlength="10" />
Why do u use the max-length attribute? An apex:inputField represents the same "attributes" like the corpesponding salesforce field. So when your field in your object is e.g. Text(10) than you automatically can store only up to 10 chars.
Related
I have an Aura component that calls an external CSS thru <ltng:require> tags. I need to save the URLs in a custom metadata or maybe custom label in Salesforce rather than hardcoded URLs in the .cmp
Snippet of .CMP
<ltng:require scripts="{!join(',',
'https://simpleui-test-au.vixverify.com/df/javascripts/greenidConfig.js',
'https://simpleui-test-au.vixverify.com/df/javascripts/greenidui.min.js')}"
afterScriptsLoaded="{! c.onLoadScript }"/>
<ltng:require styles="https://simpleui-test-au.vixverify.com/df/assets/stylesheets/greenid-mobile.css"/> ```
H newbiedev,
You can access the value of a Custom Label in your Aura Component markup by using the following syntax inside an expression: (https://developer.salesforce.com/docs/atlas.en-us.232.0.lightning.meta/lightning/labels_value_provider_platform.htm)
$Label.c.labelName
So you could use it in your require tag as follows once the Custom Labels are created:
<ltng:require scripts="{!join(',',
$Label.c.MyLabel1,
$Label.c.MyLabel2)}"
afterScriptsLoaded="{! c.onLoadScript }"/>
<ltng:require styles="{!$Label.c.MyLabel3}"/> ```
I have created a custom link for a custom object and it works. But it's not controlled by FLS so I have to move to Formula field.
What should I do to turn it to a formula field?
Here's my custom link codes:
https://sanofi-pharmachina--dev1.cs5.my salesforce.com/a0C?rlid=01I7F000002B91V&id={Account_Plan_vod__r.Account.ID!}
a0C is object code
01I7F000002B91V is object ID
{Account_Plan_vod__r.Account.ID!}
How should I turn this to a formula field with proper codes?
Thanks!
The HYPERLINK formula, this should work. It shows your link as a clickable url on the detail page of a record:
HYPERLINK("/a0C?rlid=01I7F000002B91V&id=" & Account_Plan_vod__r.Account.ID,"Link Text here")
I have a form that has some fields.
One field is autocomplete
.
The field is filled with information from a table
$f->addField('autocomplete','idfield','Field')->setValueList( $this->api->db->dsql()
->table('items')->field('id,name')->do_getAssoc() );
I'm trying to set the focus on that field when the page loads.
I have did this
On top of the page
$p->js()->_load('seteo_foco');
And then
seteo_foco.js
$(function(){
$("select:first").focus();
})
But this does not work.
Anybody can help ?
Thanks
Try TRUE like
$this->js(true)->_load('seteo_foco'); to load js file.
But in your js code your selector is incorrect. You need to specify you unique field. I'd use something like $form->getElement('field_name')->js(true)->focus(); on the page after the form has been initialized.
I have a VF page with a lot of fields. the requirement is that all the error messages on the fields need to be listed together at the top of the page and have field level error messages. Currently, we have something like this:
<apex:inputField value = 'f1' />
<apex:inputField value = 'f2' />
When the user clicks submit, at the controller level, I check if either of the fields are blank, and if they are, i return an aggregated error. but i don't know how to render the red required bar since all this is happening at the controller level
Basically, the requirement is
for the required fields have a red bar
if the fields are not filled in, display field level errors
For all the field level errors, display a message at the top of the page saying the user needs to enter in these values
You can use (Required="true") attribute. This attribute is of apex:inputField tag. This attribute will give you field level error. you dont need to do coding in controller.
And for all field level errors, you have to add one VF tag <apex:pagemessages />. this tag will show you all error messages together.
If you want to take it a step further and add errors for business logic rather than just empty fields, take a look at the addError() functionality within APEX code.
http://wiki.developerforce.com/page/An_Introduction_to_Exception_Handling
I have a custom link on the opportunity object which points to an external site. Is it possible to add this custom link to a visualforce page?
The solution I came up with was to copy the url salesforce creates for this custom link, and paste it in the page. It looks something like this:
my custom link
This works fine, however, it won't work once it's in a managed package installed on other servers because the lid param will be different (the custom link id). Is there a solution for this?
Have you thought about putting the URL of the link in a field on the opportunity object and then creating an output link on your VF page?
Paul
Look under $Action. Buttons and links are available via that global variable. For example $Action.Opportunity.CustomLink
To build off the answer from danieljimenez, the $Action global variable provides access to the button/link objects. From there you need to use the URLFOR function to get it into a usable form. Then you can either put it into the action param of a command button, or use it as you'd like anywhere else in your markup.
<apex:commandButton action="{!URLFOR($Action.My_Obj__c.My_custom_link)}" value="My custom button"/>
or
My link
create New Contact (Salesforce button target _blank)
<apex:commandLink target="_blank"
styleClass="btn"
style="text-decoration:none;padding:4px;"
action="{!URLFOR($Action.Contact.NewContact)}"
value="Create New Contact" />