Wednesday, October 3, 2007

9 tricks on Web Development

1. If you upload files via iframe, and you want to cancel the uploading process, set src attributes of the iframe to 'blank.html' or 'about:blank'.
2. To begin uploading, use $('form').submit();
3. Use min-height for firefox and height for IE for setting the minimum height of the container
4. When finished adding record to the database, redirect_to the page itself or other pages otherwise the browser still contain the post data and if the user press F5, it will post the previous data to the server again. For rails don't use render :action, instead use redirect_to :action
5. For Update, you need to check the errors collection to make sure your data is fully validated because it doesn't raise any exceptions when the data failed the validation.
6. Rails doesn't support render more than one action.
7. Don't suppose redirect_to will end the action. If you want to this way, add "and return" after redirect_to.
8. GROUP_CONCAT function cannot used with other datatypes except String. To convert to string, use CAST(field AS CHAR).
9. The onchange event of select html tag doesn't fire when the user scroll the list using keyboard on Firefox, to solve add keyup event.

No comments:

Subscribe in a Reader