As with last checkin for customer, we now have special coloration for required fields, as well as blank required fields.
git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@754 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -45,6 +45,7 @@ function contactMethodDiv($obj, $type, $legend, $values = null) {
|
||||
' CLASS="'.$type.'-method-%{id}-source" ' . "\n" .
|
||||
' ID="'.$type.'-method-%{id}-source-'.$stype.'"' . "\n" .
|
||||
' VALUE="'.$stype.'"' . "\n" .
|
||||
($stype == 'new' ? ' CHECKED' . "\n" : '') .
|
||||
' />' . "\n" .
|
||||
' <LABEL FOR="'.$type.'-method-%{id}-source-'.$stype.'">'.$sname.'</LABEL>' . "\n" .
|
||||
' ';
|
||||
@@ -76,21 +77,30 @@ function contactMethodDiv($obj, $type, $legend, $values = null) {
|
||||
'fields' => array
|
||||
(
|
||||
'preference' => array
|
||||
('opts' => array
|
||||
('label_attributes' => array('class' => 'required'),
|
||||
'opts' => array
|
||||
('options' => $obj->varstore['methodPreferences'],
|
||||
'selected' => (isset($values) ? $values['ContactsMethod']['preference'] : null),
|
||||
)),
|
||||
),
|
||||
'after' => "Intended purpose for using this method of communication.",
|
||||
),
|
||||
|
||||
'type' => array
|
||||
('opts' => array
|
||||
('label_attributes' => array('class' => 'required'),
|
||||
'opts' => array
|
||||
('options' => $obj->varstore['methodTypes'],
|
||||
'selected' => (isset($values) ? $values['ContactsMethod']['type'] : null),
|
||||
)),
|
||||
),
|
||||
'after' => "How / Where this communication reaches the contact.",
|
||||
),
|
||||
|
||||
'comment' => array
|
||||
('opts' => array
|
||||
('label_attributes' => array('class' => 'optional empty'),
|
||||
'opts' => array
|
||||
('value' => (isset($values) ? $values['ContactsMethod']['comment'] : null),
|
||||
)),
|
||||
),
|
||||
'after' => "Optional: Comments on how this form of communication relates to the contact.",
|
||||
),
|
||||
|
||||
))) . "\n" .
|
||||
|
||||
@@ -113,16 +123,23 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) {
|
||||
if ($type === 'phone') {
|
||||
if ($stype === 'existing') {
|
||||
$fields = array
|
||||
('id' => array('name' => 'Phone/Ext',
|
||||
('id' => array('label_attributes' => array('class' => 'required empty'),
|
||||
'name' => 'Phone/Ext',
|
||||
'opts' => array('options' => $obj->varstore['contactPhones'])),
|
||||
);
|
||||
}
|
||||
elseif ($stype === 'new') {
|
||||
$fields = array
|
||||
('type' => array('opts' => array('options' => $obj->varstore['phoneTypes'])),
|
||||
'phone' => true,
|
||||
'ext' => array('name' => "Extension"),
|
||||
'comment' => true,
|
||||
('type' => array('label_attributes' => array('class' => 'required'),
|
||||
'opts' => array('options' => $obj->varstore['phoneTypes']),
|
||||
'after' => "Physical type of the phone."),
|
||||
'phone' => array('label_attributes' => array('class' => 'required empty'),
|
||||
'after' => "Required: Phone number."),
|
||||
'ext' => array('name' => "Extension",
|
||||
'label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: Extension number."),
|
||||
'comment' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: Comments about this phone number."),
|
||||
);
|
||||
}
|
||||
elseif ($stype === 'show') {
|
||||
@@ -149,12 +166,19 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) {
|
||||
}
|
||||
elseif ($stype === 'new') {
|
||||
$fields = array
|
||||
('address' => true,
|
||||
'city' => true,
|
||||
'state' => true,
|
||||
'postcode' => array('name' => 'Zip Code'),
|
||||
'country' => true,
|
||||
'comment' => true,
|
||||
('address' => array('label_attributes' => array('class' => 'required empty'),
|
||||
'after' => "Required: First line of mailing address."),
|
||||
'city' => array('label_attributes' => array('class' => 'required empty'),
|
||||
'after' => "Required."),
|
||||
'state' => array('label_attributes' => array('class' => 'required empty'),
|
||||
'after' => "Required."),
|
||||
'postcode' => array('name' => 'Zip Code',
|
||||
'label_attributes' => array('class' => 'required empty'),
|
||||
'after' => "Required."),
|
||||
'country' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: USA is presumed."),
|
||||
'comment' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: Comments about this mailing address."),
|
||||
);
|
||||
}
|
||||
elseif ($stype === 'show') {
|
||||
@@ -177,13 +201,16 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) {
|
||||
if ($stype === 'existing') {
|
||||
$fields = array
|
||||
('id' => array('name' => 'Email',
|
||||
'label_attributes' => array('class' => 'required'),
|
||||
'opts' => array('options' => $obj->varstore['contactEmails'])),
|
||||
);
|
||||
}
|
||||
elseif ($stype === 'new') {
|
||||
$fields = array
|
||||
('email' => true,
|
||||
'comment' => true,
|
||||
('email' => array('label_attributes' => array('class' => 'required empty'),
|
||||
'after' => "Required: E-mail address."),
|
||||
'comment' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: Comments about this email address."),
|
||||
);
|
||||
}
|
||||
elseif ($stype === 'show') {
|
||||
@@ -204,7 +231,7 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) {
|
||||
'<div ' . "\n" .
|
||||
' class="'.$type.'-%{id}-div"' . "\n" .
|
||||
' id="'.$type.'-%{id}-'.$stype.'-div"' . "\n" .
|
||||
(isset($values) ? '' : ' STYLE="display:none;"' . "\n") .
|
||||
((isset($values) || $stype == 'new') ? '' : ' STYLE="display:none;"' . "\n") .
|
||||
'>' . "\n" .
|
||||
|
||||
$obj->element
|
||||
@@ -319,8 +346,27 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) {
|
||||
.slideDown();
|
||||
}
|
||||
|
||||
function setEmpty(input_elem) {
|
||||
selector = "label[for=" + $(input_elem).attr("id") + "]";
|
||||
if ($(input_elem).val() == '')
|
||||
$(selector).addClass('empty');
|
||||
else
|
||||
$(selector).removeClass('empty');
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
resetForm();
|
||||
|
||||
// In case refresh is hit with populated fields
|
||||
$(":input").each(function(i,elem){ setEmpty(elem); });
|
||||
|
||||
// keyup doesn't catch cut from menu
|
||||
$(":input").live('keyup', function(){
|
||||
setEmpty(this);
|
||||
});
|
||||
$(":input").live('mouseup', function(){
|
||||
setEmpty(this);
|
||||
});
|
||||
});
|
||||
|
||||
--></script>
|
||||
@@ -345,17 +391,30 @@ echo($this->element
|
||||
array('class' => 'item contact detail',
|
||||
'caption' => isset($this->data['Contact']) ? 'Edit Contact' : 'New Contact',
|
||||
'fields' => array
|
||||
('first_name' => true,
|
||||
'last_name' => true,
|
||||
'middle_name' => true,
|
||||
'display_name' => true,
|
||||
'company_name' => array('name' => 'Company'),
|
||||
'id_federal' => array('name' => 'SSN'),
|
||||
'id_local' => array('name' => 'ID #'),
|
||||
'id_local_state' => array('name' => 'ID State'),
|
||||
('last_name' => array('label_attributes' => array('class' => 'required empty'),
|
||||
'after' => "Required."),
|
||||
'first_name' => array('label_attributes' => array('class' => 'recommended empty'),
|
||||
'after' => "Recommended."),
|
||||
'middle_name' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional."),
|
||||
'display_name' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: Will default to customer name."),
|
||||
'company_name' => array('name' => 'Company',
|
||||
'label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: Company name, if corporate contact."),
|
||||
'id_federal' => array('name' => 'SSN',
|
||||
'label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: Social Security Number."),
|
||||
'id_local' => array('name' => 'ID #',
|
||||
'label_attributes' => array('class' => 'recommended empty'),
|
||||
'after' => "Recommended: Driver's license, for example."),
|
||||
'id_local_state' => array('name' => 'ID State',
|
||||
'label_attributes' => array('class' => 'recommended empty'),
|
||||
'after' => "Recommended: State which issued the ID"),
|
||||
/* 'id_local_exp' => array('name' => 'ID Expiration', */
|
||||
/* 'opts' => array('empty' => true)), */
|
||||
'comment' => true,
|
||||
'comment' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: Comments about this contact."),
|
||||
))) . "\n");
|
||||
|
||||
echo $form->submit('Update') . "\n";
|
||||
|
||||
@@ -250,7 +250,7 @@ function customerContactTypeDiv($obj, $stype, $values = null) {
|
||||
.slideDown();
|
||||
}
|
||||
|
||||
function setEmpty(input_elem) {
|
||||
function setEmpty(input_elem) {
|
||||
selector = "label[for=" + $(input_elem).attr("id") + "]";
|
||||
//$("#debug").append($(input_elem).attr("id") + ": " + $(input_elem).val() + "<BR>");
|
||||
if ($(input_elem).val() == '')
|
||||
|
||||
Reference in New Issue
Block a user