Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2015-04-23 04:54 PM
Hi All,
We have a custom object in Archer 5.4 which compares start and end date. If the end date selected by the user is less than (before) start date it will give warning message and not allow to save or apply the record.
Post upgrade to Archer 5.5 SP2 the functionality is not working.
It will restrict the user form save or apply the record is end date if less than start sate but will not give warning message (pop up box).
Have attached the querry used in 5.4 below. Any help will be highly appreciated.
Regards,
Chirag.
<script type="text/javascript">
var startDate = 4507, startDateValue;
var endDate = 14721, endDateValue;
var messageBoxText = "Please select a valid end date. End date cannot be before Start date";
var messageBoxTitle = 'Warning';
var daysToCompare = -1;
Sys.Application.add_load(function() {
// Hijack Save/Apply Buttons
$('#master_btnSave').attr('href',"#").removeAttr("onclick").unbind("click").click(function(){ DateCheck
('save');return false;});
$('#master_btnSave > div > div > img').removeAttr('onclick').unbind("click");
$('#master_btnApply').attr('href',"#").removeAttr('onclick').unbind("click").click(function(){ DateCheck
('apply');return false;});
$('#master_btnApply > div > div > img').removeAttr('onclick').unbind("click");
});
function DateCheck(type) {
//Get Date Values
startDateValue = new Date(String(ArcherTech.UI.GenericContent.GetInstance().getFieldValue(startDate, false)));
endDateValue = new Date(String(ArcherTech.UI.GenericContent.GetInstance().getFieldValue(endDate, false)));
if(startDateValue && endDateValue) {
if(daydiff(parseDate(startDateValue), parseDate(endDateValue)) <= daysToCompare) {
WarningAlert(messageBoxText,'',messageBoxTitle);
} else {
SaveApply(type)
}
} else {
SaveApply(type)
}
}
function SaveApply(type) {
if (type == 'save') {
ShowAnimationAndPostback('master$btnSave');
} else if (type == 'apply') {
ShowAnimationAndPostback('master$btnApply');
}
}
function parseDate(str) {
str = str.getMonth()+1 + '/' + str.getDate() + '/' + str.getYear();
var mdy = str.split('/')
return new Date(mdy[2], mdy[0]-1, mdy[1]);
}
function daydiff(first, second) {
return (second-first)/(1000*60*60*24)
}
</script>
2017-07-19 10:50 AM
David Petty wrote:
Thanks Sam, the WarningAlert is an Archer function to display a dialog box; fitting with Archer UI to the user. Though looking at that function call, it seems that I've got the parameters wrong for the call. Tiara hasn't reported any errors being reported in the browsers console since she first reported about an error in radwindowscript.js. Since then we've changed the way the script is checking the dates and it's not getting to that line.
Tiara replace (line 27), WarningAlert(messageBoxText,'',messageBoxTitle); with WarningAlert(messageBoxText,messageBoxTitle);
Still a no go. here is what the console provides:
'weaknessStartDate' is undefined on this line
weaknessStartDateValue = new Date(String(ArcherTech.UI.GenericContent.GetInstance().getFieldValue(weaknessStartDate, false)));
workspace.aspx says object doesn't support this property or method
2017-07-19 10:57 AM
Ah were getting somewhere now
During name changes for the variable something got messed up with weaknessStartDate variable. On line 2 change var weaknessWeaknessStartDate = 22883, weaknessWeaknessStartDateValue; to var weaknessStartDate = 22883, weaknessStartDateValue; You had weakeness listed twice in the variable name
Advisory Consultant
2017-07-19 11:05 AM
Ok something as simple as that and I thought I changed it. IT WORKED YAY!!!! Thank you so much.
2017-07-19 11:08 AM
My pleasure Tiara.
The simple things in JavaScript that drive one insane
Advisory Consultant
2017-07-19 01:05 PM
Ok this time its a question. Can I have multiple custom objects in one application that validate dates? This date has a DDE on it so its not required until the record status says complete...so it doesn't need to validate the date until the user changes the status to completed.
2017-07-19 01:12 PM
It could be added the current custom object, but you'd have to make changes to the DateCheck function in order for you to do this by adding extra checks against the status field along with adding additional variables for the new date field and for the status values list.
Advisory Consultant
2017-08-17 04:35 PM
Hey David,
I'm at it again just in 6.2.3 and the alert box appears but it doesn't allow us to save. I think it is because the javascript is trying to find the apply button. can you please help with this. I tried to use the same javascript and make changes to the saveapply function. Please help. Thanks
2018-03-07 09:39 AM
Hi David,
i am trying to get a selected value list value in Archer v6.2 and tried the span , id and Name and found no luck all it comes is empty or undefined any suggestions would be of great help.
$('input[id*="f29963c"').text()
$('#master_DefaultContent_rts_s2621_f29963c').val()
$('#master_DefaultContent_rts_s2621_f29963c').find('option:selected').text();
2018-03-07 09:49 AM
Are you making the call inside of Sys.Application.add_load(function() { $('input[id*="f29963c_shf"').val()}); ?
Advisory Consultant
2018-03-07 10:29 AM
Hi David ,
thanks a lot for the reply , i get text in the form of JSON ,but not the value alone which is text : working fine
is there any already method which returns only text ?
{"enabled":true,"value":"14004:0","text":"working fine","selected":true,"active":true}
Submit to Finding Owner