Jump to:

21278 Posts in 5728 Topics by 2599 members

General Questions

SilverStripe Forums » General Questions » Is there a link form field?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 516 Views
  • bostonmark
    Avatar
    Community Member
    10 Posts

    Is there a link form field? Link to this post

    I'm building out the data layer of a new page type and I want editors to be able to have an isolated field for a link to a page. It can either be an external link or an internal link to another CMS-managed page. Is there some sort of link field type? I'm reviewing http://doc.silverstripe.org/sapphire/en/2.3/reference/form-field-types and don't see one.

  • Ryan M.
    Avatar
    Forum Moderator
    309 Posts

    Re: Is there a link form field? Link to this post

    You could use a TextField to allow people to enter a http://www link into it. Other than that you'd have to extend FormField and create your own field type to handle links.

  • Rodolfo
    Avatar
    Community Member
    11 Posts

    Re: Is there a link form field? Link to this post

    Hi,

    I was wondering if this has changed since last year?

    Regards

  • swaiba
    Avatar
    Forum Moderator
    1674 Posts

    Re: Is there a link form field? Link to this post

    No and it's quite easy to goto the api docs and view the children of Formfield to get the answer - or just have a look in "sapphire\forms".

    What's wrong with teh previous solution?

  • Rodolfo
    Avatar
    Community Member
    11 Posts

    Re: Is there a link form field? Link to this post

    Hi Swaiba,

    I'm still learning my way through SS.

    The redirect page already has a field of this type so I'm just going to try to reuse that same code, and perhaps create a new custom field.

    I'll post my findings soon.

    Regards

  • Martin D.
    Avatar
    Community Member
    11 Posts

    Re: Is there a link form field? Link to this post

    I think Rodolfo's question is legitimate. Silverstripe really should have a single field for internal and external links.

    Rodolfo, any news on your custom field?

    516 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.