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   556 Views

Avatar
CMSPlayer

Community Member, 25 Posts

2 April 2012 at 7:33pm

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

Forum Moderator, 5513 Posts

5 April 2012 at 11:07pm

Edited: 05/04/2012 11:08pm

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

Community Member, 25 Posts

10 April 2012 at 10:15am

Hi Willr,

Thanks for that.

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

Avatar
CMSPlayer

Community Member, 25 Posts

10 April 2012 at 11:00am

Never mind.

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

All good now.