IE6: Invalid Argument Error

If you are using ExtJS and getting an “Invalid Argument” Javascript error in IE6, make sure to check your CSS for example, i get them when dynamically setting “Width” on an element. If the value is not conventionally expressed in pixels. IE will choke on it while Firefox will still accept it. Make sure then to check your style for mispelled words, or incorrectly specified widths or heights

Maven WAR plugin: Copying resources to another folder

For the purpose of building an exploded war for my application I am using the maven-war-plugin. There is a common set of UI files that are used by the applications i am working so they’ve been exported to their own SVN folder and the build process copies this folder to the final WAR or exploded war directory. After playing with my POM for a while and trying the maven-resources-plugin without much success, i ran into the <webResources> property of the maven-war-plugin. This is the maven-resources-plugin functionality adapted to the maven war plugin. I originally set up my configuration as such:


<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-war-plugin</artifactId>
 <version>2.0</version>
 <configuration>
 <webappDirectory>c:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\${project.artifactId}-${env}</webappDirectory>
 <webResources>
 <resource>
 <targetPath>common</targetPath>
 <filtering>false</filtering>
 <directory>C:\eclipseGalileo\eclipse\workspace\common</directory>
 <includes>
 <include>**/*.*</include>
 </includes>
 <excludes>
 <exclude>**/*.svn</exclude>
 </excludes>
 </resource>
 </webResources>
 </configuration>
 </plugin>

No luck in getting it work although there were no errors in syntax, all the files in the “common” directory just were getting copied to the root of my webapp directory in my exploded war no matter what the path was i specified
for “targetPath”. The simple fix for that was to upgrade my version of the plugin to 2.1 as such:

<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>

Et voila! Problem solved.

ExtJS: ComboBox display issues

I was trying to set up a couple of comboBoxes for a custom ExtJS triple input (Month/Day/Year) datefield and the comboxes would display but be cropped to 17px. No matter what the width i set on the control, the boxes would not display right. I tried a few things and finally realized that i had specified a “hiddenName” property to be the same as the field’s ” id” property. If such is the case, make sure to specify a unique “hiddenId” property and your comboBoxes will display fine.

Disappearing Ext JS RadioGroup and CheckboxGroup inputs in IE6

I ran into an issue in IE6 with a bunch of my controls not showing up when the page loaded. It was specially with the RadioGroup control in ExtJS. The radio buttons would display fine in Firefox but not appear at all in IE6 even though the HTML was present. I thought it was a width or height issue as it is often the case with ExtJS and IE6 but nothing i did could take care of the problem. I then looked at the container panels of the RadioGroups i was trying to display and realized that i was using a “layout:column” setting, which floats the items in the container left.

During my research on this bug, i stumbled upon a bug in IE6 called the “PeekABoo” bug where content inside a liquid floated bug suddenly disappears. I am not exactly sure the issue is completely related to the problems I was facing but it seems related. In order to get my radiogroups to display, i had to change the value to “layout:auto”. This worked for me and it is the default value if no layout property is specified. In general, I’ve found out that display issues in IE also are related to setting an actual width or height property on panel objects.  Well you know what to try in case you run into the issue and share in the comments whatever solution worked for you. It can be nightmarish to figure out what’s going on, and this is the reason why i decided to share my experiences on this blog.

Disappearing ExtJS buttons in IE 6

I officially hate IE6 and know the reason why now, ExtJS. Working with this library has opened my eyes to the deficiencies in the browser. Enough has been said on the topic so let me get to the meat of the matter.I spent a crazy amount of time figuring out why one button i was trying to set up would not display in IE6. It would some some kind of image, but would only show the entire button when the button was hovered on with the mouse. I tried setting the width, the height, the line height with no results. Here is how i was trying to set up my button:


var lookupButton = new Ext.Button({
text:'Lookup',
style:'float:right'
})

Doing so, i got an error in IE6 that stated:

el.owner.createDocument.createRange Object doesn’t support this property or method.

It turns out this is a bug in IE where trying to insert a block level element after a plain text creates this error. The solution for me was to add a span around the text i was creating like:


{
width: this.displayWidth,
html: '<span>' +  String(this.value) + '</span>'

}

Hope it helps!

Using the CakePHP 1.2 Email component

I was following the documentation at

http://book.cakephp.org/view/269/Sending-a-basic-message

about sending an email with CakePHP using the Email component, used the sample code they provided but could not get my application to send email. A little bit of googling helped me figure out what was going on. I have CakePHP setup within my XAMPP htdocs directory and my MercuryMail server was not started. You need to have a mail server setup to be able to send email and there are a few more steps you need to do as well to get up and running. It’s beautifully summarized here:

http://www.zoe.vc/2008/mercury-mail-transport-system-fur-externe-mail-konfigurieren/

Once your Mercury is properly setup, you are good to send emails from CakePHP!!!

Lesson learned i guess!

Hope It Helps!

Validating a checkbox in CakePHP 1.2

I was looking for a good way to validate a checkbox for a site i was working on, and came upon this link that pointed me in the right direction:

http://teknoid.wordpress.com/2008/06/10/validating-a-checkbox-in-cakephp-12/

I followed the instruction, mainly:


'agree' => array(
'rule' => array('comparison', '!=', 0),
'required' => true,
'message' => 'You must agree to the terms of use',
'on' => 'create'
)

But for some reason, it would not work for me no matter what i tried, my checkbox still failed validation, even when the box was checked. I narrowed down the problem to the:

'required' => true,

line. It seemed to break the validation for a reason I do not know. So removing this line should get you through the validation correctly. I did my validation another way by using a new CakePHP core validation function, inList. Here is the code i use to account for all possible values i am expecting my checkbox to have when checked. I added it to the necessary model class:



'terms_of_use'=>array(
'rule' => array('inList', array('1',1,'true', true,'on')),
'message' => 'You need to accept the Terms Of Use to be able to register.')

As you can see, the ‘inList’ validation will check to see if the checkbox value is within the array values submitted so you can account for all possible values you need your checkboxes to have to pass validation. This will improve reusability within your code.

Hope It Helps.

%d bloggers like this: