I'm attempting to change a textbox value whenever a user checks a checkbox in Adobe Acrobat Pro XI using Javascript, and am inexperienced in it. I am getting an error of Syntax Error: Illegal Character 7: at line 9 based on the below code:
//Checked
if (this.getField("myCheckBox").value != "Off") {
this.getField("myTextBox").value = util.printd("mm/dd/yyyy HH:MM:ss", new Date());
//Not Checked
} else {
this.getField("myTextBox ").value = “”;
}
I have the feeling I need to change the brackets somehow, can anyone clarify?
Thanks for any help!
the quotation marks in the else clause are not the "correct" quotation marks
this.getField("myTextBox ").value = “”; // <-- change these to ""
also, probably need to remove the white-space after "myTextBox "
try...
this.getField("myTextBox").value = "";
Related
The function bellow returns the first empty row on column A.
The sheet became full, I extended it with another 9000 rows, I ran main manually and I got an error, "TypeError: Cannot read property "0" from undefined".
The problem it seems to be that the 1001'th row cannot be read, values[1001] returns nothing, undefined. Am I missing something or am I limited to 1000 rows of data ?
Thank you for reading, here is the code:
function getLastRowNumber(sheetName){
// sheetName: string; returns intege (the last row number based on column A)
var sheet = getSheet(sheetName);
var column = sheet.getRange('A1:A'); // THIS IS THE PROBLEM
var values = column.getValues(); // get all data in one call
// DEBUG
Logger.log(values[1001][0])
var ct = 0;
while (values[ct][0] != "") {
ct++;
}
return (ct);
}
EDIT:
Solution: use .getRange('A:A'); instead of the 'A1:A' notation.
Thank you #tehhowch for the solution.
Posting this answer so people can see it, the solution was provided by #tehhowch.
By using "A:A" as the argument of getRange fixes the problem.
I cannot update update this Boolean value in Apex. What is going wrong? The if statement, and the fact that the front end representation is a checkbox, proves that it is indeed a boolean value. I am new to Apex so I feel its a basic misunderstanding of how it works. Can anyone help me out?
Here is the code that I'm executing in an Anonymous Window.
Account acc = new Account(Name='Test Name');
if (acc.Do_Not_Contact__pc == false) {
System.debug('DNC is false');
} else {
System.debug('DNC is true');
}
insert acc;
acc.Do_Not_Contact__pc = true;
update acc;
It fails on the second to last line, displaying the following message:
System.DmlException: Update failed. First exception on row 0 with id 001W000000fFiVbIAK; first error: INVALID_FIELD_FOR_INSERT_UPDATE, Account: bad field names on insert/update call: Do_Not_Contact__pc: [Do_Not_Contact__pc]
What's particularly frustrating is that when I change the second to last line to
acc.Do_Not_Contact__pc = 'true';
I get an error stating that I cannot assign a String to a Boolean value
Remove the single quotes and I assume you typed the field name wrong. Try acc.Do_Not_Contact__c = true;
I'm having problem binding the data to the grid when I filter using the operator EndsWith.
fieldfilter.Filter1.Operator.ToString == "IsEqualTo"
fieldFilter.Filter1.Value = fieldFilter1.Value.ToString().PadRight(120, ' ');
In the database the values of the column have the Leading Spaces, and I had problem making it work for IsEqualTo also but I fixed it by padding leading spaces to the right of the input string. (as shown below)
But, I'm not sure how I should do it for the EndsWith Filter Operator.
I'm able to get the rows from the database by using where condition like '%ABC'.
But the rows are not binding to the grid.
When you get the callback from DB with the collection(collection).
queueColl = new HierarchyItemCollection();// the original collection- before
List<HierarchyItem> items = new List<HierarchyItem>(collection.OrderBy(item => item.Text));
items.ForEach(item =>
{
item.Tag = (stcQueue)item.Tag;
item.ObjectData = null;
queueColl.Add(item);
});
radTreeOH.DataContext = queueColl; // I am having a tree.
I'm trying to create an XTemplate, and one of my dataIndexes has a period... so my data looks something like this:
{
"one": 1,
"two.one": 21,
"two.two": 22
}
Now, when I'm creating the template, I can't do something like {two.one} because that thinks two is the beginning of an object, and then I'm accessing its key one. I've tried doing something like {'two.one'}, but this also doesn't work, and I've tracked it down to the culprit in Ext.XTemplateCompiler.parseTag. This code is what breaks it:
// compound Javascript property name (e.g., "foo.bar")
else if (isNaN(name) && name.indexOf('-') == -1 && name.indexOf('.') != -1) {
v = "values." + name;
}
// number or a '-' in it or a single word (maybe a keyword): use array notation
// (http://jsperf.com/string-property-access/4)
else {
v = "values['" + name + "']";
}
So with my two.one string, I get into that else if, but what I really want is the else that follows right after it. Unfortunately, it doesn't seem like I can override this in an easy way... does anybody have any thoughts? I'm using Ext JS 4.2.1.
Thanks to skirtle over on the Sencha Forums, I was able to solve it:
Instead of using {two.one} or {'two.one'}, it should be {[values['two.one']]}. Using values directly was the ticket.
I have two forms called fmMain and fmEmpl. Both have each TStatusBar called sbMain and sbEmpl. I have a TDataModule called dmData to store the database components.
I need to update the sbEmpl panels so it can displays actual values from the database when the cell grid is highlighted. I've been try to use the TClientDataSet's OnAfterScroll handler to handling this event but it just working on fmMain only, not with fmEmpl. It always raising error message if I try to update the sbEmpl panels. This is the message:
Access violation at address 00405337 in module 'SpeZet.exe'. Read of address 0000038C.
Whereas, I have including both header (.h) on dmData.
What going wrong with TStatusBar here?
Any idea?
Thank a lot in advance.
EDIT : Ok, here is the code:
void __fastcall TdmData::cdsEmplAfterScroll(TDataSet *DataSet)
{
vEmpl = "Name = " +
dmData->cdsEmpl->FieldByName("Name")->AsString +
" | idEmployee = " +
dmData->cdsEmpl->FieldByName("idEmployee")->AsInteger +
" | idJob = " +
dmData->cdsEmpl->FieldByName("idJob")->AsInteger;
fmMain->sbMain->SimplePanel = true;
fmMain->sbMain->SimpleText = vEmpl;
fmEmpl->sbEmpl->SimplePanel = true;
fmEmpl->sbEmpl->SimpleText = vEmpl;
}
The "Access Violation" message is raised at line:
fmEmpl->sbEmpl->SimplePanel = true;
fmEmpl->sbEmpl->SimpleText = vEmpl;
Most probably your datamodule doesn't have a valid pointer to your fbEmpl form.
Finally, based on this article, I have solve this problem.. I didn't notice that dmData is created before the fmEmpl so it will raising any "Access Violation" error message when I try to access the fmEmpl.
I make simple condition to check if fmEmpl was created or yet. This is the condition:
if (fmEmpl != NULL) {
sbEmpl->SimplePanel = true;
sbEmpl->SimpleText = sData;
}
Now, I can accessing and updating the sbEmpl directly from dmData.
Thanks.