Jump to:

10845 Posts in 2513 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » [Userform] Change the action to an External URL

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1310 Views
  • LunakO2
    Avatar
    Community Member
    4 Posts

    [Userform] Change the action to an External URL Link to this post

    Hello All,

    Is it possible to take the action URL as an input from the user so that the form can be submitted to external sites (example: Wufoo)

    Which PHP Classes/Files would I be required to modify to support this functionality?

    Thanks in Advance.

    - Kunal Shetye

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: [Userform] Change the action to an External URL Link to this post

    I think changing the URL is going to be tricky as UDF uses the built in Form classes in SilverStripe. I'm pretty sure you cannot change the action to be external for built in forms. If you wanted to then the way I would imagine you could do it is to alter the Form objects html using an extension to UserDefinedForm. You can customize the form by defining a function updateForm(&$form) in your extension but still not 100% sure how you would get access to the FormAction.

    Perhaps using UserForms isn't the best idea.

  • LunakO2
    Avatar
    Community Member
    4 Posts

    Re: [Userform] Change the action to an External URL Link to this post

    Willr,

    There is no way for me to add <form> / <input> elements in the Content Field of a Page, otherwise I would have to resort to Userforms

    Is there anything else that I could use so that I can use a custom form that posts to an external URL?

    Thanks!

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: [Userform] Change the action to an External URL Link to this post

    Is there anything else that I could use so that I can use a custom form that posts to an external URL?

    If the form is static (aka they don't need to change it in the CMS) then simply make your own shortcode handler. You can then make a template file that has the form html you require it in and you bypass the SilverStripe form functionality entirely.

    http://www.ssbits.com/tutorials/2010/2-4-using-short-codes-to-embed-a-youtube-video/
    http://doc.silverstripe.org/shortcodes

  • LunakO2
    Avatar
    Community Member
    4 Posts

    Re: [Userform] Change the action to an External URL Link to this post

    Willr,

    The forms are going to be dynamic in nature, in fact the whole purpose of using Silverstripe in the first place to have the flexibility of editing forms effortlessly, plus other features and benefits.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: [Userform] Change the action to an External URL Link to this post

    Ah ok then I guess your best option is to subclass the UserDefinedForm class (and its controller) and replace the UserDefinedForm_Controller process() function to post to your Wufoo URL. You would probably also need to tweak the process function to make the submitted data make the Wufoo fields since UDF will have form fields with names such as 'EditableTextField12' which Wufoo would not know how to handle.

    1310 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.