forked from Wavyzz/dolibarr
Try to add a help message in input fields
This commit is contained in:
@@ -227,8 +227,8 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans('DeliveryAddressLabel').'</td><td><input type="text" size="30" name="label" value="'.$livraison->label.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Name').'</td><td><input type="text" size="30" name="nom" value="'.$livraison->nom.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('DeliveryAddressLabel').'</td><td><input type="text" size="30" name="label" id="label" value="'.($livraison->label?$livraison->label:$langs->trans('RequiredField')).'" '.addHelpMessage("label",$langs->trans('RequiredField')).'></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Name').'</td><td><input type="text" size="30" name="nom" id="nom" value="'.($livraison->nom?$livraison->nom:$langs->trans('RequiredField')).'" '.addHelpMessage("nom",$langs->trans('RequiredField')).'></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft">';
|
||||
print $livraison->adresse;
|
||||
|
||||
@@ -543,6 +543,7 @@ FieldsWithIsForPublic=Fields with <b>%s</b> are shown on public list of members.
|
||||
AccordingToGeoIPDatabase=(according to GeoIP convertion)
|
||||
Line=Line
|
||||
NotSupported=Not supported
|
||||
RequiredField=Required field
|
||||
|
||||
# Week day
|
||||
Day1=Monday
|
||||
|
||||
@@ -542,6 +542,7 @@ FieldsWithIsForPublic=Les champs marqués par <b>%s</b> seront affiches sur la l
|
||||
AccordingToGeoIPDatabase=(obtenu par conversion GeoIP)
|
||||
Line=Ligne
|
||||
NotSupported=Non supporté
|
||||
RequiredField=Champ obligatoire
|
||||
|
||||
# Week day
|
||||
Day1=Lundi
|
||||
|
||||
@@ -3136,4 +3136,26 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an help message in input field
|
||||
* @param inputId Id of input field
|
||||
* @param message Help message
|
||||
* @return include Code to include if javascript is enable
|
||||
*/
|
||||
function addHelpMessage($inputId,$message)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$tempMessage = '';
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
$tempMessage.= ' style="color: grey;"';
|
||||
$tempMessage.= 'onFocus="hideMessage(\''.$inputId.'\',\''.$message.'\');" ';
|
||||
$tempMessage.= 'onBlur="displayMessage(\''.$inputId.'\',\''.$message.'\');"';
|
||||
}
|
||||
|
||||
return $tempMessage;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
// Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
// Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
//
|
||||
// Script javascript added in header of pages (in HEAD section)
|
||||
//
|
||||
@@ -65,7 +65,7 @@ function company_save_refresh()
|
||||
Purpose: Pour la saisie des dates par calendrier
|
||||
Input: base "/theme/eldy"
|
||||
dateFieldID "dateo" Nom du champ
|
||||
format "dd/MM/yyyy" Format issu de Dolibarr de SimpleDateFormat <20> utiliser pour retour
|
||||
format "dd/MM/yyyy" Format issu de Dolibarr de SimpleDateFormat <20> utiliser pour retour
|
||||
==================================================================*/
|
||||
|
||||
function showDP(base,dateFieldID,format)
|
||||
@@ -674,3 +674,31 @@ var win = new Window({className: "dialog",
|
||||
win.getContent().update(message);
|
||||
win.showCenter();
|
||||
}
|
||||
|
||||
/*=================================================================
|
||||
Purpose: Hide a temporary message in input text fields
|
||||
Input: fiedId
|
||||
Input: message
|
||||
Author: Regis Houssin
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
function hideMessage(fieldId,message) {
|
||||
var textbox = document.getElementById(fieldId);
|
||||
textbox.style.color = 'black';
|
||||
if (textbox.value == message) textbox.value = '';
|
||||
}
|
||||
|
||||
/*=================================================================
|
||||
Purpose: Display a temporary message in input text fields
|
||||
Input: fieldId
|
||||
Input: message
|
||||
Author: Regis Houssin
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
function displayMessage(fieldId,message) {
|
||||
var textbox = document.getElementById(fieldId);
|
||||
if (textbox.value == '') {
|
||||
textbox.style.color = 'grey';
|
||||
textbox.value = message;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user