Skip to content
Snippets Groups Projects
Commit 996cb9d3 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

NEW Add function ajax_autoselect

parent 0a35d172
No related branches found
No related tags found
No related merge requests found
......@@ -347,6 +347,25 @@ function ajax_dialog($title,$message,$w=350,$h=150)
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.
* 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
$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 $urllink;
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 '<input type="text" style="width: 60%" '.($action == 'edit' ? 'disabled' : '').' id="opensurveyurl" name="opensurveyurl" value="'.$url.'">';
if ($action != 'edit') print ajax_autoselect("opensurveyurl", 1);
print '</td></tr>';
......
......@@ -209,7 +209,8 @@ function showPaypalPaymentUrl($type,$ref)
$out='<br><br>';
$out.=img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>';
$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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment