9

I am planning to build a web-to-lead form(Visual Force page) with Lightning Design System. The form will take some inputs from the user and pass the same to controller and controller will perform some logic before entering the data into Salesforce lead object. So a very basic visual force page. But I have few questions which I am listing below. So if anyone can help me to get clarity here that will be really helpful.

  • The org where this visual force page will execute is still not Lightning enabled. But as long as I am using Lightning Design System, I should get Lightning look and feel and also the responsiveness, correct?
  • I noticed in Trailhead module it is mentioned that we can use Lightning Design System in VF page if the functionality is about accessing data using Javascript remoting or remote objects. But since I need to take the input from user and pass it to controller, do you think I can still use Lightning Design System in Visualforce page and it can serve the purpose?
11

The answer to your first question is "YES". The second answer, however, varies.

If you plan to use <apex:inputText>, <apex:pageBlock> and other things like that, then the Trailhead (and I) recommend that you do not attempt to use SLDS. The main reason for this is that SLDS is a self-described work in progress and therefore you're going to be chasing changes constantly. Remember, you're going to have to write some CSS to override the default stylesheets, so you really don't want a moving target. Also (Safe Harbor), it has been implied that tools to make that transition easier are coming.

If, however, you don't mind using regular <input> (and <div>, and the like) to build your page and use Remoting (or other Javascript-based tech) to talk to your controller, then there you no longer have the problems described in the first step.

In short, if you have to use the VF tags then perhaps you don't want to do SLDS. If, however, you can use the JS-oriented tools (or are willing to learn them) then SLDS is a good fit for you.

  • 1
    Actually, I'm working on such a project, and it's actually a fair approximation. – sfdcfox Sep 2 '16 at 21:32
  • Professional curiosity.... I wonder how much of a PITA it is to do? – Sebastian Kessel Sep 2 '16 at 21:34
  • 1
    +1 on the answer .If you are using apex:inputfield and using binding via getters and setters then some advanced tags like enhanced list views etc do not work well .If you are using just normal HTML inputs and HTML5 inputs then SLDS works well – Mohith Shrivastava Sep 2 '16 at 21:34
  • 1
    @SebastianKessel I'm sure it's not "perfect," and I haven't played with all the nuances, but basically SLDS completely overrides the standard VF CSS, so you end up getting something that looks very much like Lightning. I've only used basic input types, like checkboxes and text fields so far, but it's awfully convincing that you're not in VF. It's not so much a PITA, but there's a lot to learn in SLDS, and I've only just started. – sfdcfox Sep 2 '16 at 21:36
  • That's great to know. I wonder why the Trailheads warn so strongly against it... perhaps because of <apex:detail> and <apex:enhancedlist>... – Sebastian Kessel Sep 2 '16 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.