Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions

Incorporate data lookup function within the user defined form module


Reply

4 Posts   523 Views

Avatar
CMSPlayer

2 April 2012 at 7:33pm Community Member, 25 Posts

Hi,

As per the thread subject heading, I've been studying the back-end code structure that makes how user defined form is crafted and I want to know the module is capable to handle data lookup function when entering the form's fields.

For eg, the application I'm trying to develop is online projects application form to be submitted by our online volunteer members.

I have the form with the following fields.

Membership ID
First Name
Last Name
Email:

When a volunteer member enters a form with his membership id, I want the form to process the data lookup on his form and determine if this membership ID is valid. If the membership ID is found, then message onscreen will confirm the member that the membership id is found thus 'First Name', 'Last Name', and 'Email' fields data are retrieved on the form.

I'm wondering would the user defined form module cater that functionality or do I need to extend that functionality in the user defined form?

Hope that makes sense.

Avatar
Willr

5 April 2012 at 11:07pm (Last edited: 5 April 2012 11:08pm), Forum Moderator, 5511 Posts

I would approach this by creating a custom form field. UDF will automatically pick up any subclasses of EditableFormField so you can write you own (incl validation) rather easily.

The best examples are to look at the inbuilt EditableFormField sub classes. Here's a basic example of one I wrote for a module - https://github.com/willrossi/silverstripe-googlemapselectionfield/blob/master/code/EditableGoogleMapSelectableField.php.

EditableMemberListField (https://github.com/silverstripe/silverstripe-userforms/blob/master/code/editor/EditableMemberListField.php) does something *similar* with regards to the look up

Avatar
CMSPlayer

10 April 2012 at 10:15am Community Member, 25 Posts

Hi Willr,

Thanks for that.

I tried the links - but they don't appear to be working?

Avatar
CMSPlayer

10 April 2012 at 11:00am Community Member, 25 Posts

Never mind.

Look like the website was out of order momentarily...

All good now.