NEW Add function ajax_autoselect
This commit is contained in:
parent
0a35d17207
commit
996cb9d3f1
@ -347,6 +347,25 @@ function ajax_dialog($title,$message,$w=350,$h=150)
|
|||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a input box content all selected
|
||||||
|
*
|
||||||
|
* @param string $htmlname Id of html object
|
||||||
|
* @param int $addlink Add a link to after
|
||||||
|
*/
|
||||||
|
function ajax_autoselect($htmlname, $addlink=0)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$out = '<script type="text/javascript">
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
jQuery("#'.$htmlname.'").click(function() { jQuery(this).select(); } );
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
if ($addlink) $out.=' <a href="'.$url.'" target="_blank">'.$langs->trans("Link").'</a>';
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a html select field into an ajax combobox.
|
* Convert a html select field into an ajax combobox.
|
||||||
* Use ajax_combobox() only for small combo list! If not, use instead ajax_autocompleter().
|
* Use ajax_combobox() only for small combo list! If not, use instead ajax_autocompleter().
|
||||||
|
|||||||
@ -338,18 +338,8 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
|
|||||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||||
|
|
||||||
$url=$urlwithouturlroot.dol_buildpath('/public/opensurvey/studs.php',1).'?sondage='.$object->id_sondage;
|
$url=$urlwithouturlroot.dol_buildpath('/public/opensurvey/studs.php',1).'?sondage='.$object->id_sondage;
|
||||||
$urllink='<input type="text" style="width: 60%" '.($action == 'edit' ? 'disabled' : '').' id="opensurveyurl" name="opensurveyurl" value="'.$url.'">';
|
print '<input type="text" style="width: 60%" '.($action == 'edit' ? 'disabled' : '').' id="opensurveyurl" name="opensurveyurl" value="'.$url.'">';
|
||||||
print $urllink;
|
if ($action != 'edit') print ajax_autoselect("opensurveyurl", 1);
|
||||||
if ($action != 'edit')
|
|
||||||
{
|
|
||||||
print '<script type="text/javascript">
|
|
||||||
jQuery(document).ready(function () {
|
|
||||||
jQuery("#opensurveyurl").click(function() { jQuery(this).select(); } );
|
|
||||||
});
|
|
||||||
</script>';
|
|
||||||
print ' <a href="'.$url.'" target="_blank">'.$langs->trans("Link").'</a>';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -209,7 +209,8 @@ function showPaypalPaymentUrl($type,$ref)
|
|||||||
$out='<br><br>';
|
$out='<br><br>';
|
||||||
$out.=img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>';
|
$out.=img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>';
|
||||||
$url=getPaypalPaymentUrl(0,$type,$ref);
|
$url=getPaypalPaymentUrl(0,$type,$ref);
|
||||||
$out.='<input type="text" id="paypalurl" class="quatrevingtpercent" value="'.$url.'"><br>';
|
$out.='<input type="text" id="paypalurl" class="quatrevingtpercent" value="'.$url.'">';
|
||||||
|
$out.=ajax_autoselect("paypalurl", 0);
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user