case 'text':
case 'textarea':
-
+ case 'picklist':
+
$formField[$fieldId] = '';
// If the expected form field exists
$fieldRes['field_data'] = ($in ? 'Yes' : 'No');
break;
-
+
default:
break;
$checkbox_data = ($fType=='checkbox' ? $field['submitted'] : false);
$integer_data = ($fType=='integer' ? $field['submitted'] : false);
$float_data = ($fType=='float' ? $field['submitted'] : false);
+ $text_data = ($fType=='text'||$fType=='picklist' ? $field['submitted'] : '');
$res = $this->wpdb->update(
GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_DB_PREFIX.'custom_field_data',
* @return object Class object
*
*/
- public function entryPostProcessing($r, $a)
+ public function entryPostProcessing($r, $action)
{
// Get field type description from ini file.
$r['field_type_descr'] = $this->config['custom_field_type'][$r['field_type']];
-
+
+ // If doing the following actions
+ if (in_array($action, array('l','g'))) {
+
+ // Try to get additional data for specific field types
+ switch ($r['field_type']) {
+
+ case 'picklist':
+
+ if (!isset($FieldOptions)) {
+ require_once GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_CLASS_PATH.'/data/dataCustomFieldsOption.php';
+ $FieldOptions = new GlmDataFieldsCustomFieldsOption($this->wpdb, $this->config);
+ }
+
+ // Try to get any options for this picklist
+ $options = $FieldOptions->getList('T.field_id = '.$r['id']);
+
+ $r['options'] = false;
+ if (is_array($options) && count($options) > 0) {
+ $r['options'] = $options;
+ }
+
+ break;
+
+ default:
+ break;
+ }
+
+ }
return $r;
}
--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Fields Option
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package GLM Member-DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataFields.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataEvent class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ */
+class GlmDataFieldsCustomFieldsOption extends GlmDataAbstract
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Data Table Name
+ *
+ * @var $table
+ * @access public
+ */
+ public $table;
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter
+ * functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+ /**
+ * MemberInfo DB object
+ *
+ * @var $MemberInfo
+ * @access public
+ */
+ public $MemberInfo;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ * @param array $config Configuration array
+ * @param bool $limitedEdit Flag to say indicate limited edit requested
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($wpdb, $config, $limitedEdit = false)
+ {
+
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Table Name
+ */
+ $this->table = GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_DB_PREFIX . 'custom_field_options';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Field ID
+ 'field_id' => array (
+ 'field' => 'field_id',
+ 'type' => 'integer',
+ 'use' => 'a'
+ ),
+
+ // Option Text - Displayed text for option
+ 'option_text' => array(
+ 'field' => 'option_text',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Option Value - Value of this option
+ 'option_value' => array(
+ 'field' => 'option_value',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Option Cost
+ 'option_cost' => array(
+ 'field' => 'option_cost',
+ 'type' => 'money',
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Option Default
+ 'option_default' => array(
+ 'field' => 'option_default',
+ 'type' => 'checkbox',
+ 'use' => 'a'
+ )
+ );
+
+ }
+
+ /*
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * In this case we're using it to append an array of category
+ * data to each member result and also sort by member name.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing($r, $a)
+ {
+ return $r;
+ }
+
+}
custom_field_type['text'] = 'Single Line Text Field'
custom_field_type['textarea'] = 'Multi-Line Text Area'
custom_field_type['checkbox'] = 'Checkbox'
-; custom_field_type['picklist'] = 'Picklist of Options'
+custom_field_type['picklist'] = 'Picklist of Options'
; custom_field_type['integer'] = 'Integer Number'
; custom_field_type['float'] = 'Floating Point number'
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Custom Fields - Field options
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Custom Fields Picklist Options Data Class
+require_once GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_CLASS_PATH.'/data/dataCustomFieldsOption.php';
+
+
+/*
+ * This class performs the work of handling images passed to it via
+ * an AJAX call that goes through the WorPress AJAX Handler.
+ *
+ */
+class GlmMembersAdmin_ajax_customFieldOptions extends GlmDataFieldsCustomFieldsOption
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for data class
+ parent::__construct(false, false);
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This modelAction takes an AJAX image upload and stores the image in the
+ * media/images directory of the plugin.
+ *
+ * This model action does not return, it simply does it's work then calls die();
+ *
+ * @param $actionData
+ *
+ * @return No return is expected from this model. Content should be output then wp_die();
+ */
+ public function modelAction ($actionData = false)
+ {
+
+ switch($_REQUEST['option']) {
+
+ case 'addNewOption':
+
+ $fieldOption = $this->insertEntry();
+
+ if (!is_array($fieldOption) || !$fieldOption['status']) {
+ echo "0";
+ } else {
+
+ // Produce HTML for the new field
+ $viewFile = 'admin/ajax/newFieldOption.html';
+ $fieldOption['fieldData']['fid'] = $_REQUEST['fid'];
+
+ $newFieldHtml = $this->generateHTML($fieldOption, $viewFile);
+ echo $newFieldHtml;
+
+ }
+
+ break;
+
+ case 'deleteOption':
+
+ $fieldId = false;
+
+ if (isset($_REQUEST['id'])) {
+ $fieldId = $_REQUEST['id'] - 0;
+
+ if ($fieldId <= 0) {
+ echo false;
+ wp_die();
+ }
+ }
+
+ // Delete this custom field
+ $this->deleteEntry($fieldId, true);
+ echo true;
+
+ break;
+
+ default:
+
+ }
+
+ wp_die();
+ }
+
+
+ /**
+ * Merge template and data to produce HTML
+ *
+ * Checks the theme's view directories and the view directories for
+ * this plugin for a matching view file.
+ *
+ * Note that $viewFile needs to have the proper view directory path
+ * includes. (i.e. "/views/front/registrations/summary.html")
+ *
+ * @param $data array Array of data to merge with the template
+ * @param $view string Path added to
+ *
+ * @access public
+ * @return void
+ */
+ function generateHTML($data, $viewFile)
+ {
+
+ // If a view file is specified
+ if ($viewFile) {
+
+ // Get the specified view file - check theme first
+ $viewPath = GLM_MEMBERS_PLUGIN_CURRENT_THEME_DIR."/views";
+ $viewPath2 = GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_PATH . "views"; // Save default
+
+ // If the view is not found in the theme, fall back to views in the plugin
+ if (!is_file($viewPath.'/'.$viewFile)) {
+
+ // Next try the plugin/add-on
+ $viewPath = GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_PATH . "/views";
+
+ if (!is_file($viewPath.'/'.$viewFile)) {
+
+ if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+ trigger_error("Bad or missing view file when generating checkout HTML: $viewPath/$viewFile", E_USER_NOTICE);
+ }
+
+ }
+
+ }
+
+ }
+
+ // Load Smarty Template support
+ $smarty = new smartyTemplateSupport();
+
+ // Add standard parameters
+ require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php';
+
+ // Add data from model to Smarty template
+ if (is_array($data) && count($data) > 0) {
+ foreach ($data as $k => $d) {
+ $smarty->templateAssign($k, $d);
+ }
+ }
+
+ // Update the Smarty view path
+ $smarty->template->setTemplateDir($viewPath);
+
+ // If the view path doesn't match the default, add the default (using theme view)
+ if ($viewPath2 != $viewPath) {
+ $smarty->template->addTemplateDir($viewPath2);
+ }
+
+ // Generate output from model data and view
+ $out = $smarty->template->fetch($viewFile);
+
+ return $out;
+
+ }
+
+
+
+}
<?php
-
/**
* Gaslight Media Members Database
* Custom Fields Form Management
trigger_error(print_r($_REQUEST,1),E_USER_NOTICE);
switch($_REQUEST['option']) {
-
+
case 'addNewField':
$customField = $this->insertEntry();
echo $newFieldHtml;
}
- wp_die();
break;
case 'deleteField':
// Delete this custom field
$this->deleteEntry($fieldId, true);
echo true;
- wp_die();
break;
default:
- wp_die();
}
wp_die();
if ( isset($custom_fields) && $custom_fields && count( $custom_fields ) > 0 ) {
$haveCustomFields = true;
}
-
+
+
// Compile template data
$template_data = array(
'option2' => $option,
'adminActions' => array(
'ajax' => array(
'customFields' => GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_SLUG,
+ 'customFieldOptions' => GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_SLUG,
'customFieldsFront' => GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_SLUG
),
'customFields' => array(
<td style="font-weight: bold; text-align: left;">{$fieldData.field_name}</td>
<td id="editFieldType_{$fieldData.id}">{$fieldData.field_type_descr}</td>
<td>{$fieldData.required.name}</td>
- <td>
+ <td colspan="2">
<!-- <div class="glmCustomFieldsEditFieldButton button button-secondary glm-button-small" data-fieldID="{$fieldData.id}" data-fieldName="{$fieldData.field_name|escape:'html'}" data-fieldPrompt="{$fieldData.field_prompt|escape:'html'}" data-fieldType="{$fieldData.field_type.name|escape:'html'}" data-adminSearch="{$fieldData.admin_search.value}" data-required="{$fieldData.required.value}">Edit</div>
-->
<div class="{$fieldData.fid}_DeleteFieldButton button button-secondary glm-button-small" data-fieldID="{$fieldData.id}">Delete</div>
{if $fieldData.field_type=='picklist'}
- <div class="AddOptionButton button button-secondary glm-button-small" data-fieldId="{$fieldData.id}">Add Option</div>
+ <div class="{$fieldData.fid}_AddOptionButton button button-secondary glm-button-small" data-fieldId="{$fieldData.id}">Add Option</div>
{/if}
</td>
</tr>
- <tr class="FieldRow_{$fieldData.id}"><td colspan="4">Prompt: {$fieldData.field_prompt}</td></tr>
\ No newline at end of file
+ <tr class="FieldRow_{$fieldData.id}"><td colspan="4">Prompt: {$fieldData.field_prompt}</td></tr>
+ {if $fieldData.field_type=='picklist'}
+ <tr>
+ <th style="text-align: left; padding-left: 2rem;">Option Value</th>
+ <th style="text-align: left;">Option Text</th>
+ <th style="text-align: left;">Cost</th>
+ <th style="text-align: left;">Default</th>
+ <th> </th>
+ </tr>
+ {/if}
+ <tr><td style="border-bottom: 1px solid black;" colspan="4"> </td></tr>
\ No newline at end of file
--- /dev/null
+{* A line describing the new picklist option. *}
+
+<tr id="FieldOptionRow_{$fieldData.id}">
+ <td style="text-align: left; padding-left: 2rem;"">{$fieldData.option_value}</td>
+ <td style="text-align: left;">{$fieldData.option_text}</td>
+ <td style="text-align: left;">{$fieldData.option_cost}</td>
+ <td style="text-align: left;">{$fieldData.option_default.name}</td>
+ <td style="text-align: left;">
+ <div class="DeleteOptionButton_{$fieldData.fid} button button-secondary glm-button-small" data-fieldOptionId="{$fieldData.id}">Delete</div>
+ </td>
+</tr>
+
<table class="glm-admin-table" style="width: 100%">
<tr>
<th class="glm-required" style="width: 20%; white-space: nowrap;">Option Name (for reference):</th>
- <td><input id="{$fid}_NewOptionName" type="text" name="option_value" class="glm-form-text-input-short"></td>
+ <td><input id="{$fid}_NewOptionValue" type="text" name="option_value" class="glm-form-text-input-short"></td>
</tr>
<tr>
<th class="glm-required">Displayed Text:</th>
</tr>
<tr>
<th style="width: 20%; white-space: nowrap;">Selected by Dedault</th>
- <td><input id="{$fid}_NewOptionDefault]" type="checkbox" name="option_default"></td>
+ <td><input id="{$fid}_NewOptionDefault" type="checkbox" name="option_default"></td>
</tr>
<tr>
<th>Cost:</th>
<th style="text-align: left;">Field Name</th>
<th style="text-align: left;">Type</th>
<th style="text-align: left;">Required</th>
- <th style="text-align: left;" width="10%">
+ <th style="text-align: left;" width="10%" colspan="2">
<div id="{$fid}_newFieldButton" class="button button-primary glm-button-small">Add a Custom Field</div>
</th>
<td style="text-align: left;">
{$t.required.name}
</td>
- <td style="width: 10%; text-align: left;">
+ <td style="width: 10%; text-align: left;" colspan="2">
<!-- <div class="{$fid}_EditFieldButton button button-secondary glm-button-small" data-fieldId="{$t.id}" data-fieldName="{$t.field_name|escape:'html'}" data-fieldPrompt="{$t.field_prompt|escape:'html'}" data-fieldType="{$t.field_type.name|escape:'html'}" data-required="{$t.required.value}">Edit</div>
-->
<div class="{$fid}_DeleteFieldButton button button-secondary glm-button-small" data-fieldId="{$t.id}">Delete</div>
{if $t.field_type=='picklist'}
- <div id="{$fid}-add-option-button" class="button button-secondary glm-button-small" data-fieldId="{$t.id}">Add Option</div>
+ <div class="{$fid}_AddOptionButton button button-secondary glm-button-small" data-fieldId="{$t.id}">Add Option</div>
{/if}
</td>
</tr>
- <tr class="FieldRow_{$t.id}"><td style="border-bottom: 1px solid black;" colspan="4"">Prompt: {$t.field_prompt}</td></tr>
+ <tr class="FieldRow_{$t.id}"><td colspan="4"">Prompt: {$t.field_prompt}</td></tr>
+ {if $t.field_type=='picklist'}
+ <tr>
+ <th style="text-align: left; padding-left: 2rem;">Option Value</th>
+ <th style="text-align: left;">Option Text</th>
+ <th style="text-align: left;">Cost</th>
+ <th style="text-align: left;">Default</th>
+ <th> </th>
+ </tr>
+ {if $t.options}
+ {foreach $t.options as $option}
+ <tr id="FieldOptionRow_{$option.id}">
+ <td style="text-align: left; padding-left: 2rem;">{$option.option_value}</td>
+ <td style="text-align: left;">{$option.option_text}</td>
+ <td style="text-align: left;">{$option.option_cost}</td>
+ <td style="text-align: left;">{$option.option_default.name}</td>
+ <td style="text-align: left;">
+ <div class="DeleteOptionButton_{$fid} button button-secondary glm-button-small" data-fieldOptionId="{$option.id}">Delete</div>
+ </td>
+ </tr>
+ {/foreach}
+ {/if}
+ {/if}
+ <tr id="EndOfFieldOptions_{$t.id}"><td style="border-bottom: 1px solid black;" colspan="5"> </td></tr>
{/foreach}
{/if}
</tbody>
if (fieldHtml == '') {
flashElement('{$fid}_NewFieldDialogError');
} else {
-
+
+ // Add new field to form
$('#{$fid}_FieldsListBody').append(fieldHtml);
$("#{$fid}_NewFieldDialog").dialog("close");
- // Need to rebind edit field buttons
+ // Need to rebind some buttons
$('body').off('click', '.{$fid}_EditFieldButton', {$fid}_editFieldButton);
$('body').on('click', '.{$fid}_EditFieldButton', {$fid}_editFieldButton);
-
- // Need to rebind delete field buttons
$('body').off('click', '.{$fid}_DeleteFieldButton', {$fid}_deleteFieldButton);
$('body').on('click', '.{$fid}_DeleteFieldButton', {$fid}_deleteFieldButton);
+ $('body').off('click', '.{$fid}_AddOptionButton', {$fid}_AddOptionButton);
+ $('body').on('click', '.{$fid}_AddOptionButton', {$fid}_AddOptionButton);
+ $('body').off('click', '#{$fid}_NewOptionCancel', {$fid}_NewOptionCancel);
+ $('body').on('click', '#{$fid}_NewOptionCancel', {$fid}_NewOptionCancel);
}
});
});
// Display form
$('body').on('click', '.{$fid}_EditFieldButton', {$fid}_editFieldButton);
- function {$fid}_editFieldButton() {
+ function {$fid}_editFieldButton(e) {
var fieldID = $(this).attr('data-fieldId');
var fieldName = $(this).attr('data-fieldName');
var fieldPrompt = $(this).attr('data-fieldPrompt');
dialogClass: "glm-dialog-no-close"
});
// Display form and reset all input
- $('#{$fid}-add-option-button').click( function() {
- var fieldId = $(this).attr('data-fieldId');
-alert(fieldId);
+ $('body').on('click', '.{$fid}_AddOptionButton', {$fid}_AddOptionButton);
+ function {$fid}_AddOptionButton(e) {
+ var {$fid}_fieldId = $(this).attr('data-fieldId');
+
$("#{$fid}_NewOptionDialog").dialog("open");
$('#{$fid}_NewOptionName').val('');
$('#{$fid}_NewOptionText').val('');
$('#{$fid}_NewOptionCost').val('');
$('#{$fid}_NewOptionSubmit').data('data-fieldId', $(this).attr('data-fieldId'));
- });
+ };
// Submit form
- $('#{$fid}_NewOptionSubmit').click( function() {
-console.log($(this).attr('data-fieldId'));
+ $('#{$fid}_NewOptionSubmit').click( function(e) {
+
// Collect the new field data
var formData = {
- 'action': 'glm_members_admin_ajax',
- 'glm_action': 'customFields',
- 'option': 'addNewPicklistOption',
- 'field_id': $(this).attr('data-fieldId'),
- 'field_name': $('#{$fid}_NewFieldName').val(),
- 'field_prompt': $('#{$fid}_NewFieldPrompt').val(),
- 'field_type': $('#{$fid}_NewFieldType').val(),
- 'required': $('#{$fid}_NewFieldRequired').is(':checked')
+ 'action': 'glm_members_admin_ajax',
+ 'glm_action': 'customFieldOptions',
+ 'option': 'addNewOption',
+ 'field_id': $('#{$fid}_NewOptionSubmit').data('data-fieldId'),
+ 'option_value': $('#{$fid}_NewOptionValue').val(),
+ 'option_text': $('#{$fid}_NewOptionText').val(),
+ 'option_cost': $('#{$fid}_NewOptionCost').val(),
+ 'option_default': $('#{$fid}_NewOptionDefault').is(':checked'),
+ 'fid': '{$fid}'
};
-alert(formData.field_id);
-return;
+
// Submit new field data - expect field new ID back
$.ajax({
type: 'POST',
encode: true,
dataType: 'text'
})
- .done( function(fieldHtml) {
- if (fieldHtml == '') {
+ .done( function(optionHtml) {
+ if (optionHtml == '') {
flashElement('{$fid}_NewFieldDialogError');
} else {
-
- $('#{$fid}_FieldsListBody').append(fieldHtml);
- $("#{$fid}_NewFieldDialog").dialog("close");
+ var {$fid}_fieldId = $('#{$fid}_NewOptionSubmit').data('data-fieldId');
+ $('#EndOfFieldOptions_'+{$fid}_fieldId).before(optionHtml);
+ $("#{$fid}_NewOptionDialog").dialog("close");
- // Need to rebind edit field buttons
- $('body').off('click', '.{$fid}_EditFieldButton', {$fid}_editFieldButton);
- $('body').on('click', '.{$fid}_EditFieldButton', {$fid}_editFieldButton);
-
- // Need to rebind delete field buttons
- $('body').off('click', '.{$fid}_DeleteFieldButton', {$fid}_deleteFieldButton);
- $('body').on('click', '.{$fid}_DeleteFieldButton', {$fid}_deleteFieldButton);
+ // Need to rebind delete option buttons
+ $('body').off('click', '.DeleteOptionButton_{$fid}', DeleteOptionButton_{$fid});
+ $('body').on('click', '.DeleteOptionButton_{$fid}', DeleteOptionButton_{$fid});
}
});
});
// Cancel
- $('#{$fid}_NewOptionCancel').click( function() {
+ $('body').on('click', '#{$fid}_NewOptionCancel', {$fid}_NewOptionCancel);
+ function {$fid}_NewOptionCancel(e) {
$("#{$fid}_NewOptionDialog").dialog("close");
- });
+ };
+ // Delete
+ $('body').on('click', '.DeleteOptionButton_{$fid}', DeleteOptionButton_{$fid});
+ function DeleteOptionButton_{$fid}(e) {
+
+ var {$fid}_optionDeleteId = $(this).attr('data-fieldOptionId');
+ // Delete the selected option and remove it from the display
+ var formData = {
+ 'action': 'glm_members_admin_ajax',
+ 'glm_action': 'customFieldOptions',
+ 'option': 'deleteOption',
+ 'id': {$fid}_optionDeleteId,
+ 'fid': '{$fid}'
+ };
+ $.ajax({
+ type: 'POST',
+ url: '{$ajaxUrl}',
+ data: formData,
+ encode: true,
+ dataType: 'text'
+ })
+ .done( function(deleted) {
+ $('#FieldOptionRow_' + {$fid}_optionDeleteId).remove();
+ });
+
+ };
// Flash an element for a short time
function flashElement(id) {
</div>
</div>
{/if}
+ {if $field.field_type == 'picklist'}
+ <div class="glm-row">
+ <div class="glm-small-12 glm-large-12 glm-columns glm-nowrap{if $field.required.value} glm-required{/if}">{$field.field_prompt}</div>
+ <div class="glm-small-12 glm-large-12 glm-columns glm-nowrap{if $field.required.value} glm-required{/if}">
+ <select id="glmCustomFormField_{$field.id}" type="checkbox" name="glmCustomFormField_{$field.id}">
+ <option value=""></option>
+ {foreach $field.options as $option}
+ <option value="{$option.option_value}"> {$option.option_text}
+ {/foreach}
+ </select>
+ </div>
+ </div>
+ {/if}
{/foreach}
{/if}