Advanced usage of Ajax Control Toolkit MaskedEdit Extender - ajaxcontroltoolkit

How can I achieve the following with the Ajax Control Toolkit MaskedEdit extender?
Letter + Any number of numeric chararacter such as Z234, Z235, Z24, etc

It appears that it may not be possible....

mask="A999" isn't it working? If its always in format Z[number][number][number] ... try mask="Z999".

Related

What is the best way to escape HTML on ExtJS application generally?

I am developing a web application using ExtJS to build GUI and communicate with server via RESTful web-service (the returned data is formatted as JSON objects).
Now I am having problems when processing with data which contains HTML tags, Javascript codes inside; because when I set those values to Ext forms, labels, input fields, they are affected by those syntaxes.
I used this function to load data from model object to form:
form.loadRecord(model);
I have found a solution to escape HTML and JS: using
field.setValue(Ext.util.Format.htmlDecode(data));
but I think that is not a good solution for whole application, because the developers must do so much things: review all input fields, labels, and put that snippet to them. And after all, that is not a beautiful way to build a fast, robust and maintainable application.
So, could you please help me solution so that it can be modified at one place, and affects to the rest. Can I override the setValue/ setLabel of AbstractComponent? Or should I encode the data before rendering them? And how to decode those data?
(P/S: I uses Grails framework on the server-side)
Thank you so much.
If you're using Ext.XTemplate, you can escape html in fields like this:
var tpl = new Ext.XTemplate(
'<p>My Field: {myField:htmlEncode}</p>'
);
Everything depends on your use case, but what I do is - escape all HTML code on server side, so that there are no 'forgotten' places by mistake. That of course creates problems, when these data need to be loaded in form fields, because they are escaped.
The easiest solution is to override setValue for all form fields and use Extjs htmlDecode function, which will revert these values back to normal.
Ext.override(Ext.form.field.Base, {
setValue: function(val) {
val = Ext.util.Format.htmlDecode(val);
return this.callParent([val]);
}
});
This link has a excellent answer by jack.slocum :
https://www.sencha.com/forum/showthread.php?13913
grid.on('validateedit', function(e){
e.value = Ext.util.Format.stripTags(e.value);
});
Util method Ext.util.Format.stripTags() removes all the html/script tags.

Dojo 1.5.x, DateTextBox and Locale

I am pulling my hair out trying to make dijit.form.DateTextBox for Dojo 1.5.1 to only use one date format for validation and formatting regardless of the user's browser's locale. Using something like this:
var d = new dijit.form.DateTextBox({name:n,displayedValue:v,format:{ formatLength:'short', selector:'date',datePattern:'MM/dd/yyyy',locale:'en' }},formElement);
...and the browser is set to French Canadian ("fr-ca") it validates a date like "10/05/2012" as being incorrect when it isn't. Why is it ignoring the explicit datePattern?
Sadly I have to use Dojo 1.5.1 as this is what ships with IBM Lotus Domino 8.5.3.
Any help or suggestions are greatly appreciated!
Cheers,
Alex
I gave this a try, I think you've mixed up "format" with "constraints." Please see the fiddle : http://jsfiddle.net/DPhxq/ Seems to validate okay even in FR-CA

WebDriver and GWT Suggest Boxes

Ok...I give up :)
What is the best way to select values out of a GWT Suggest Box using
WebDriver? I'm using FirefoxDriver, and so far nothing seems to pick
values out of a GWT suggestBox...not sendKeys, not selenium.keyUp,
anything.
I've even tried executing javascript directly to get those values to populate, like this (to no avail):
((JavascriptExecutor) driver).executeScript("document.getElementById('spSelect').value='verizon'");
Is there a better
way? If not, what is the "best" way to get values out of a GWT suggest
Box?
Many thanks in advance.
Cheers
Pedro
Ok, we've figured out our problem.
We were setting explicit IDs on our elements, so our tests can grab
them easier. In GWT this is done via:
usernameLabel.getElement().setId("consoleLoginPageUserNameInput");
This works fine for most GWT inputs, but for the SuggestBox it is
handled a bit differently:
spSelect.getElement().getElementsByTagName("input").getItem(0).setId("spSelect");
After grabbing the correct inner table, we are able to interact with
this input with Selenium just fine. Hope this helps someone.
Cheers
Pedro
Try this javascript (from here):
To set the value:
document.getElementById("spSelect")["value"] = "verizon"
To retrieve it:
var value = document.getElementById("spSelect")["value"];

cfscript Code Assist in CFBuilder

I'm increasingly using cfscript, and like it where appropriately used.
One problem is that there doesn't appear to be any code assist for cfscript in CF Builder, so I find myself writing the tag of a function to leverage the code Assist, then converting to cfscript (which is silly).
For example:
addParam() is the cfscript equivalent of <cfqueryparam >. I get code assist when writing the the tag version, but not the script equivalent.
Does anyone know if there is a code assist library available for cfscript in cfBuilder? Or is this just a downside of working with cfscript?
Many Thanks in advance!
Jason
Your example is not using native CFScript, it's using the hack-solution Adobe provided for some shortcomings of CFScript's coverage of CF tags, which are implemented as a bunch of CFCs in the custom tags dir of your install. This stuff is not representative of CFML & its CFScript support as a whole.
I find that CFB gives hinting for most native functionality... is this not the case for you? What if you try listAppend() for example? Do you get code-assist for that?
UPDATE
I wonder if you get a warning in CFB on your line equivalent to this:
o = new Query();
? I do, by default. I have to make a link to the CustomTags/com dir, and then use this syntax:
o = new com.adobe.Query();
Then I don't get a warning, and indeed I get the code assist you're expecting. I cannot get it to give me hinting on just the non-qualified path to Query.cfc though.
Not ideal. Or maybe I'm missing something, too.

Replace éàçè... with equivalent "eace" In GWT

I tried
s=Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "");
But it seems that GWT API doesn't provide such fonction.
I tried also :
s=s.replace("é",e);
But it doesn't work either
The scenario is I'am trying to générate token from the clicked Widget's text for the history management
You can take ASCII folding filter from Lucene and add to your project. You can just take foldToASCII() method from ASCIIFoldingFilter (the method does not have any dependencies). There is also a patch in Jira that has a full class for that without any dependencies - see here. It should be compiled by GWT without any problems. License should be also OK, since it is Apache License, but don't quote me on it - you should ask a real lawyer.
#okrasz, the foldToASCII() worked but I found a shorter one Transform a String to URL standard String in Java