Prefilled Registration Field -- Query String Param

14 years 4 months ago #11702 by moneybagsxp
We are going to be executing email campaigns, and have a few items that will be going out to a massive database.

We are including "Invitation Codes" (for automatic forum membergroup asssignment) and "Customer Number" for ties back to our source database.

It would be VERY NICE if we could simply pass the field name as a param in the URL, and have it prepopulate the form.



Would prefill Param1: textbox with "Hello World!"

I know this wouldn't do much for checkboxes, etc, thought I guess a check could be done to see if the field exists (and is shown on registration) to "select" or "set value" if value of param matches value options. (for handling checkboxes, radios, etc.)

FURTHER: Would be FANTASTIC if you could provide HIDDEN form field types during registration for database capture purposes, but not for users to fill out (initially, at least) though the ReadOnly attribute gets us very close...

Post edited by: moneybagsxp, at: 2006/05/08 18:42 - Where every pixel matters.

Please Log in to join the conversation.

14 years 4 months ago #11709 by moneybagsxp
Replied by moneybagsxp on topic Re:Prefilled Registration Field -- Query String Pa
by the way, for now I added the following code to handle our needs:

Within comprofiler.class.php Find:

function getFieldEntry($ui,&$calendars,$oType,$oName,$oDescription,$oTitle,$oValue,$oReq,$oLabel,$oID,$oSize, $oMaxLen, $oCols, $oRows,$oProfile, $rowFieldValues=null,$oReadOnly=0) {

global $ueConfig,$database,$mosConfig_live_site;



and add the following:

$oValue = ( ( $prefill = ( isset( $_REQUEST[ $oName ] ) && $oValue == null ) ) ) ? $_REQUEST[ $oName ] : $oValue ;

This should invoke the desired behaviour for TextFields/TextAreas, etc... those with NULL values, and only when the matching param is present via GET/POST.

I will be expanding this further to force such form elements to READONLY (or hide altogether) when the "pre-fill" conditions are met. We LOVE this component, but for us is used primarily as a "Registration-expansion pack"

Great work, nevertheless!


I have updated the REPLACEMENT statement above. It now captures the $prefill condition as a boolean for use further in the script.

Post edited by: moneybagsxp, at: 2006/05/08 18:19 - Where every pixel matters.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.381 seconds

Facebook Twitter LinkedIn