Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion modules/formulize/admin/save/element_options_save.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
if($changed) {
$_POST['reload_option_page'] = true; // force a reload, since the developer probably changed something the user did in the form, so we should reload to show the effect of this change
}
}
}

// check to see if we should be reassigning user submitted values, and if so, trap the old ele_value settings, and the new ones, and then pass off the job to the handling function that does that change
if(isset($_POST['changeuservalues']) AND $_POST['changeuservalues']==1) {
Expand All @@ -251,6 +251,14 @@
}
}

// replace all existing blank radio button selections to the currently selected default
if(isset($_POST['replaceblankswithdefault']) AND $_POST['replaceblankswithdefault']==1 AND $ele_type == "radio") {
if($default_entry = array_search(1, $processedValues['elements']['ele_value'])) {
$sql = "UPDATE `".$xoopsDB->prefix("formulize_".$formObject->getVar('form_handle')."` SET `".$element->getVar('ele_handle')."`='".formulize_db_escape($default_entry)."' WHERE `".$element->getVar('ele_handle')."` IS NULL OR `".$element->getVar('ele_handle')."`=''");
$xoopsDB->query($sql);
}
}

/**newly added for autocomplete box to make sure when {USERNAMES} and {FULLNAMES} are selected, system will not allow new entries to be added
*ele_value[8] ==1 will make sure it's an autocomplete box
*ele_value[16]=0 means say no match found,
Expand Down
1 change: 1 addition & 0 deletions modules/formulize/language/english/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@
define("_AM_ELE_ADD_OPT","Add %s options");
define("_AM_ELE_ADD_OPT_SUBMIT","Add");
define("_AM_ELE_OPT_CHANGEUSERVALUES", "When saving changes to these options, also change the values users have made in the form to match the new options (ie: where users had selected the old first option, replace their selection with the new first option instead)");
define("_AM_ELE_OPT_REPLACEBLANKSWITHDEFAULT", "When saving changes to these options, also replace all existing blank values with the currently selected default value.");
define("_AM_ELE_SELECTED","Selected");
define("_AM_ELE_CHECKED","Checked");
define("_AM_ELE_MULTIPLE","Allow multiple selections");
Expand Down
12 changes: 11 additions & 1 deletion modules/formulize/templates/admin/element_type_radio.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
<fieldset>
<legend><{$smarty.const._AM_ELE_OPT}></legend>
<{include file="db:admin/element_optionlist.html}>
</div>
</div>

<div class="form-item">
<fieldset>
<legend>Apply this default value to all existing blank values?</legend>
<p><label for="element-replaceblankswithdefault">
<input type="checkbox" id="element-replaceblankswithdefault" name="replaceblankswithdefault" value="1"/>
<{$smarty.const._AM_ELE_OPT_REPLACEBLANKSWITHDEFAULT}></label></p>
</fieldset>
</div>

<div class="form-item">
<fieldset>
<legend><{$smarty.const._AM_ELE_DELIM_CHOICE}></legend>
Expand Down