mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
fix textarea with select by adding a button (#30785)
Co-authored-by: Hystepik <lmarcouiller@nltechno.com>
This commit is contained in:
parent
8bbe0516f4
commit
94b3566ddc
|
|
@ -7505,6 +7505,7 @@ abstract class CommonObject
|
|||
// If the textarea field has a list of arrayofkeyval into its definition, we suggest a combo with possible values to fill the textarea.
|
||||
//var_dump($param['options']);
|
||||
$out .= $form->selectarray($keyprefix.$key.$keysuffix."_multiinput", $param['options'], '', 1, 0, 0, "flat maxwidthonphone".$morecss);
|
||||
$out .= '<input id="'.$keyprefix.$key.$keysuffix.'_multiinputadd" type="button" class="button" value="'.$langs->trans("Add").'">';
|
||||
$out .= "<script>";
|
||||
$out .= '
|
||||
function handlemultiinputdisabling(htmlname){
|
||||
|
|
@ -7526,16 +7527,16 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#'.$keyprefix.$key.$keysuffix.'_multiinput").on("change",function() {
|
||||
$("#'.$keyprefix.$key.$keysuffix.'_multiinputadd").on("click",function() {
|
||||
console.log("We add the selected value to the text area '.$keyprefix.$key.$keysuffix.'");
|
||||
tmpval = $("#'.$keyprefix.$key.$keysuffix.'").val();
|
||||
tmpvalarray = tmpval.split(",");
|
||||
valtotest = $(this).val();
|
||||
valtotest = $("#'.$keyprefix.$key.$keysuffix.'_multiinput").val();
|
||||
if(valtotest != -1 && !tmpvalarray.includes(valtotest)){
|
||||
if(tmpval == ""){
|
||||
tmpval = valtotest;
|
||||
} else {
|
||||
tmpval = tmpval + "," + valtotest;
|
||||
tmpval = tmpval + "\n" + valtotest;
|
||||
}
|
||||
$("#'.$keyprefix.$key.$keysuffix.'").val(tmpval);
|
||||
handlemultiinputdisabling("'.$keyprefix.$key.$keysuffix.'");
|
||||
|
|
|
|||
|
|
@ -472,7 +472,8 @@ class Target extends CommonObject
|
|||
public function update(User $user, $notrigger = 0)
|
||||
{
|
||||
// Clean trigger_codes
|
||||
$this->trigger_codes = preg_replace('/[\r\n\s]/', '', $this->trigger_codes);
|
||||
$this->trigger_codes = preg_replace('/\r\n/', ',', $this->trigger_codes);
|
||||
$this->trigger_codes = preg_replace('/\s/', '', $this->trigger_codes);
|
||||
|
||||
return $this->updateCommon($user, $notrigger);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user