Replace javascript by jQuery

This commit is contained in:
Laurent Destailleur 2010-08-29 15:38:47 +00:00
parent fd177b1746
commit 54489e6050
2 changed files with 22 additions and 20 deletions

View File

@ -11,20 +11,6 @@
// //
/*=================================================================
Purpose: Resubmit page when type of third party (company/individual) is changed
Input: param
Author: Laurent Destailleur
Licence: GPL
==================================================================*/
function dolibarr_type_reload(param)
{
document.formsoc.action.value='create';
document.formsoc.private.value=param;
document.formsoc.cleartype.value=1;
document.formsoc.submit();
}
/*================================================================= /*=================================================================
Purpose: Resubmit page when barcode choice is changed (admin page) Purpose: Resubmit page when barcode choice is changed (admin page)
Input: formNameID Input: formNameID

View File

@ -451,14 +451,30 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n";
print '<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () {
jQuery("#radiocompany").click(function() {
document.formsoc.action.value="create";
document.formsoc.private.value=0;
document.formsoc.cleartype.value=1;
document.formsoc.submit();
});
jQuery("#radioprivate").click(function() {
document.formsoc.action.value="create";
document.formsoc.private.value=1;
document.formsoc.cleartype.value=1;
document.formsoc.submit();
});
});';
print '</script>'."\n";
print "<br>\n"; print "<br>\n";
print $langs->trans("ThirdPartyType").': &nbsp; '; print $langs->trans("ThirdPartyType").': &nbsp; ';
print '<input type="radio" class="flat" name="private" value="0"'.(! $_REQUEST["private"]?' checked="true"':''); print '<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.(! $_REQUEST["private"]?' checked="true"':'');
print 'onclick="dolibarr_type_reload(0)"';
print '> '.$langs->trans("Company/Fundation"); print '> '.$langs->trans("Company/Fundation");
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
print '<input type="radio" class="flat" name="private" value="1"'.(! $_REQUEST["private"]?'':' checked="true"'); print '<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.(! $_REQUEST["private"]?'':' checked="true"');
print 'onclick="dolibarr_type_reload(1)"';
print '> '.$langs->trans("Individual"); print '> '.$langs->trans("Individual");
print ' ('.$langs->trans("ToCreateContactWithSameName").')'; print ' ('.$langs->trans("ToCreateContactWithSameName").')';
print "<br>\n"; print "<br>\n";