Articles
Niceforms 1.0
published on January 30th, 2007
More than a year after the initial preview of this script, I’m finally able to present its final version. Many of the bugs initially reported were solved and more scalability features have been added.
What is it?
Niceforms is a script that will replace the most commonly used form elements with custom designed ones. You can either use the default theme that is provided or you can develop your own look. You can read more about Niceforms in my initial article or take a look at an example to see it in action.
Features
Niceforms works just like your regular web form while adding a few usability improvements as well. One of these improvements would be the possibility of selecting a radio or check box by clicking its adjacent label, which is not possible on Safari browsers, for some weird reason. Niceforms also highlights the labels of the selected boxes to make the selections even clearer.
The form fields and the buttons created via Niceforms are fully scalable. You can specify their width (and height for textareas) through regular HTML properties such as size, cols and rows. For the select field, you can specify its width by simply adding a CSS class. Buttons will automatically expand to accommodate the amount of text present.
Keyboard-only navigation works although it hasn’t been tested thoroughly on Macs yet. Opera has a slight problem with this and keyboard navigation won’t work on the select fields.
Compatibility
The script is fully compatible with most major browsers, including Firefox, IE6+, Safari and Opera. Since Safari insists on styling input fields and buttons the Mac-way no matter what, Niceforms isn’t applied on these elements for this browser, leaving the default styling in place.
Themes
You can basically customize the look of your forms any way you want by creating your own themes. Since Niceforms replaces the form elements with images, it’s just a matter of slicing these images up correctly and creating the CSS that holds them all together. More themes are on the way and you’re more than welcome to contribute as well. A short guide on how to properly create themes is in progress and should be available soon.
Using Niceforms
Niceforms is applied to all forms that have the class “niceform”. You can have other classes in there as well but one of them has to be “niceform” in order for the script to work. One of the important aspects of the script is that it requires a correctly coded form, including properly declared labels and values. There’s not much room for error and, if nothing else, it will force you to code your forms correctly.
One of the biggest issues with Niceforms is that the replaced elements are absolutely positioned. What that basically means is that they’re removed from the normal page flow and thus will not support their own width and height, which may lead to layout problems. The solution is to provide a stand-alone supporting layout structure that will keep everything in place. I know this may mean that in real life implementations you’ll end up adding a few divs here and there but at this time it’s the only viable solution.
If you’ve just set up Niceforms on your server and are using IE6, you’ll notice an ugly flicker, especially on the textareas, as you move in and out of them. This can be fixed by adding a couple of lines to your Apache .htaccess file. A sample file is provided with the script but for more information on the subject you should check Dean Edward’s solution.
Acknowledgements
A lot of work has been put into creating the Niceforms script and all this would not have been possible without the support of certain people. A huge thanks goes out to Peter-Paul Koch and his awesome javascript resources. I’ve taken quite a few examples from his coding in creating Niceforms.
Another big thanks goes to all those that helped me test the script and provided excellent feedback on the initial preview. There are too many to mention them all here but needless to say, I probably couldn’t have done it without them.
The future
Past progress on the script has been tremendously slow. Hopefully things will pick up in the future. There’s still so much that can be done with this technology that I feel I’ve only began to scratch the surface. Support for multiple rows select fields and file input fields is planned for the next release. Full keyboard support for the select fields is also something I’m looking into. Many other usability improvements can be addressed as well.
Download it
Okay, I think I’ve said enough. Now it’s your turn and I would love to hear your comments, opinions and testing results on this.
Comments:
- Stilled
- January 30th, 2007
- 7:10 pm
this is great. the links also helped. thanks!
- Basti
- January 31st, 2007
- 8:06 am
I am glad to see that you are still working on Niceforms. Although, select elements still have some problems - they either close immediately or they don’t get closed. Hopefully, you’ll manage to fix this in future.
- Bramus!
- January 31st, 2007
- 3:30 pm
Great to see the updated version! Many thanks!
B!
- bluesaze
- January 31st, 2007
- 7:37 pm
small bug in the drop down menu in Firefox the drop down list doesn’t hide unless i move my mouse over the drop down list and move it away.
- badboy
- January 31st, 2007
- 7:51 pm
@bluesaze: I’m aware of that but normal behavior dictates that once you’ve activated the drop-down you’re likely to actually select something or at least move your mouse down through the options.
In any case, a fix for that is on the to-do list.
- Ozan
- February 1st, 2007
- 5:32 am
Still we can’t put a thing next to Selectbox.. :(
- Giulliano
- February 1st, 2007
- 7:52 am
Great!
Just one question. I´m using ie7 and I get message “ActiveX risk”. Is this normal in ie7.
Firefox runs 100%. :)
- badboy
- February 1st, 2007
- 8:26 am
If you’re running the demo locally (from your own computer), IE will give this warning message. This will happen for all documents that use javascript.
The warning shouldn’t be displayed when running the script from a remote server, though it may appear when IE’s security settings are set so.
- edward
- February 1st, 2007
- 11:46 am
excellente!
- Kesor
- February 1st, 2007
- 11:49 am
What about text size? Seems that this submit form for example, has small form fields - and large text gets truncated on the bottom.
- badboy
- February 1st, 2007
- 12:08 pm
Most layouts will get broken one way or the other when increasing text size quite a lot but those are extreme cases. If it supports one or two text size increases, it’s fine by me.
- Ivan Minic
- February 1st, 2007
- 12:16 pm
I really… really.. really like the way you designed this blog. Very clean, and this comment field is just gorgeous!
- Espen
- February 2nd, 2007
- 12:38 am
Awesome job you’ve done with this.
I think i’ve found a small IE bug though. I don’t know if i’ve overseen a property to set the sice for the left and right graphics of a button, but if you make them smaller and wider for instance, they will be resized in IE to fit the size of your original grahpics.
- pixeline
- February 2nd, 2007
- 2:14 am
nice work!!
anybody interested in translating this into jquery library?
- Marko
- February 3rd, 2007
- 10:21 am
I can’t believe it is finally out! I was waiting for it for more than a year since I couldn’t implement first version. Hope to deal with this one in easy way.
- Giulliano
- February 5th, 2007
- 10:10 am
Thanks for information badboy! Niceforms is Excellent!
- Typo3
- February 5th, 2007
- 10:20 am
Hi,
thank you for this verry interesting article.
greets from germany.
- Lucian Lature
- February 6th, 2007
- 6:49 am
Hi there!…
NiceForms is now translated into a jQuery plugin called NiceJForms, available at http://www.lexcat.ro/nicejforms/ .
Enjoy it!…
- David
- February 6th, 2007
- 6:57 am
But if I disable mages the form is blank!
- Milos
- February 8th, 2007
- 6:30 pm
Forms look great. I am sure I am going to use them for next design. Appreciate your work on this.
- utensil
- February 10th, 2007
- 7:33 pm
hi there_
have added a test NICEFORM to my design collective website_
http://www.utensil-ed.com/members.html
http://www.utensil-ed.com/apply_files/wforms/apply.html
have u had a chance to create an upload/browse boutton style?
also_how do recommend to best merge the form with my page design?
thanks >m
btw_still havent placed a credit for badboy on the page in case ur wondering_its coming
- Jeroen
- February 13th, 2007
- 12:36 am
When I insert a country list, I get the total list of countries. How do I get them to scroll in a bloc of 10?
- Jeroen
- February 13th, 2007
- 2:30 am
I already found a solution, but it’s not perfect yet.
You add in the css
max-height: 300px; /* Moz, Opera.. */
overflow:auto;
height: expression(this.scrollHeight > 300 ? “300px” : “auto”); /* IE */
to
.optionsDivInvisible, .optionsDivVisible
300 is variable.
But now you can’t scroll with the scrollbar in firefox.
I disabled the mouseout in the js and it works fine. You do have to select an option to close the window though.
function hideOptions(e) { //hiding the options on mouseout
// if (!e) var e = window.event;
// var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
// if(((reltg.nodeName != ‘A’) && (reltg.nodeName != ‘DIV’)) || ((reltg.nodeName == ‘A’) && (reltg.className==”selectButton”) && (reltg.nodeName != ‘DIV’))) {this.className = “optionsDivInvisible”;};
// e.cancelBubble = true;
// if (e.stopPropagation) e.stopPropagation();
}
Any solution for the last issue?
- Terry
- February 13th, 2007
- 11:55 pm
some problems in select when there are many options.
- badboy
- February 14th, 2007
- 6:25 am
You’re right about the issue of having too many entries in a select field. I’ll look into this.
- n0ta
- February 14th, 2007
- 12:22 pm
First… Great job!
Can you help me with a really weird problem?
I have tried to modify the path for the images and .js so I can put it in my common web estructure (images at “media/img/”, css at “media/css”…).
In order to make the changes, I modify the css and in the “imagepath” in the js file.
When I test it, all works fine less left and right pics in textfields and submit buttons. I am sure the problem is in the javascript file, but I can´nt solve it!
Do you know something about this “bug”?
- Terry
- February 15th, 2007
- 12:29 am
I found that any texts next to select field would be put into a newline.
- Terry
- February 15th, 2007
- 12:51 am
About the height of select field, I modified the code about the replaceSelects():
function replaceSelects() {
for(var q = 0; q
- Terry
- February 15th, 2007
- 12:54 am
A~O~
It limits words…
- Terry
- February 15th, 2007
- 2:17 am
I fixed some small bugs of select and uploaded into my space.
http://www.1dress.cn/terry/article.asp?id=4
- Chase
- February 19th, 2007
- 8:16 pm
I am having the same bug as n0ta - when modifying the image path, the left and right edges do not show up on the text fields and submit button. Ideas?
- Bruno
- February 21st, 2007
- 12:35 pm
Hi Niceform is excellent! congratulations! I am with a problem to execute events across the field Javascript select (onChange, onClick…) somebody already passed therefore?
Bruno Jackson
Brazil
- wbmstr
- February 21st, 2007
- 10:13 pm
nOta…. you have to change the reference in the css to the image… say the css file is in the directory /include/ and your images are in /images/ you need to change images/ to ../images in the .css file
- badboy
- February 22nd, 2007
- 6:14 am
If you change the image paths in the .js and .css files, the script should work just fine. However, since some of the images (such as the corners on the buttons) are cached by the javascript, it may take a few hard refreshes to get the new ones to display properly.
- Brendan
- February 25th, 2007
- 5:18 pm
Those forms look really good-I just had a question, what do you use for variable names when passing to a php script?
- Andrew
- February 26th, 2007
- 1:26 am
Hi. IE bug fixed.
I’m replace
var selectWidth = parseInt(selects[q].className.replace(/width_/g, “”))
in function replaceSelects() with
var selectWidth;
(selects[q].className != ‘’) ? selectWidth = parseInt(selects[q].className.replace(/width_/g, “”)) : selectWidth = 150;
where 150 = default width of new select, and class=”width_XX”
not necessarily write in SELECT tag.
- Hakukonemainonta
- February 26th, 2007
- 1:34 pm
Just great, I will definetely add niceforms to my site. Thanks a lot.
- Ujin
- February 28th, 2007
- 2:46 pm
That’s very beutefull form! You are really cool guys! Repect!
- Sohail Raza
- March 1st, 2007
- 8:39 pm
We are re-skining our website and use niceforms techniques. We are working in ASP.Net and when I change the select boxes with nice forms class, it looses its AutoPostBack Property. Please advise us.
Regards
- ManuDevil
- March 7th, 2007
- 7:09 am
This is fantastic with JQuery ! Thanks !
- Bash-T
- March 8th, 2007
- 11:59 am
Bug:
It seems as if this great script hast some problems displaying select-boxes inside of Tables.
As you can see here (http://img506.imageshack.us/img506/4244/niceformserrtm0.gif)
Outside a Tag, the Select Box is displayed properly. But inside the of the Tag the text is misplaced at the bottom of the page.
Noticed this Bug on Firefox 2.0.0.2 and IE7
Kind Regards
- Raul
- March 15th, 2007
- 4:38 am
Nice work!!!!! I love it. Very good improvement.
*Tips: Use ajax loader to prevent regular form elements to be lodead until images…
Felicitari !!!!
- lf
- March 16th, 2007
- 1:05 am
how can i get the value of radio
when i use onclick()?
and dont work
- Peter Kalman
- March 20th, 2007
- 6:37 pm
Hi, if you try to put an input field left of a select, then the drop down field of the select wanders off 100-102px to the left.
(Both elementes are in separate divs floating to the left side. )
While on the other hand you can put multiple selects next to each other with this method and it works perfectly. What am I missing?:)
- Eloa
- March 22nd, 2007
- 6:24 am
Great, dedicated work - I love it.
There appears to be a positioning bug with select field options though when you place a text area field above them. Any ideas or solutions?
- takingweb
- March 22nd, 2007
- 3:51 pm
very nice but i’ve some problems with select: Firefox and IE doesn’t show me any images!
- Alviro
- March 27th, 2007
- 7:35 am
why dont u add an Ajax form processor ?
- Dark$hadow
- April 2nd, 2007
- 1:44 pm
Hi!!(My english is’nt very well because I’m French…)
The result of your work is very well and I would like to use it in my website. But I have a problem with the following css attribute: td img {display: block;}
flollow this link to see the problem…
Thank you for your work it’s very beautiful and thanks too for your answers…
Good night.
- Myke
- April 5th, 2007
- 8:05 pm
Love the script… so many possibilities!
Do you have any plans to add styling for file input fields?
- Sasikumar
- April 6th, 2007
- 7:57 am
Great Work. I get an error message Operation Aborted in Internet Explorer when I use replaceSelects but it works perfect in Firefox. Any fixes to overcome this.
- Jean
- April 10th, 2007
- 12:02 am
Hi,
Very nice script, it works wonderful.
But I just got the same problem as Eloa : if you put a select after a textarea, the select content (when opened) is displayed “too low” on the page : more than 20px too far on the y axis. Any hint ?
- Thades
- April 13th, 2007
- 10:59 am
Very nice. I used Andrew’s fix for IE bug and it worked perfectly. On the other hand, I am still having a problem with FireFox and the Firebug addon. Firebug tells me there is an error when I use a select box. The premis I have is, I have two select boxes with the same entries(states) and one is billing and one is home. Now, when I select the Home state dropdown, firebug says this:
uncaught exception: Permission denied to get property HTMLDivElement.nodeName
If I disable niceforms, everything is fine. It doesn’t tell me a line number or anything so, I have no idea where to look for this bug. It may just b e a bug with Firebug and Niceforms working together. Other than that, the form still works correctly (as is).
One feature request that I would like to ask is, that since I have two select boxes, I am using javascript to update one with the other. This works when ther eis no styling. Is there any fix that I can do or feature that you can add that, when you want to update a selectbox with the value of another via a checkbox, let’s say, that the one being updated refreshes so the correct text is displayed?
- Jeroen
- April 14th, 2007
- 11:08 pm
Hi there,
I love your niceforms solution and am trying to implement it. However, I’m developing in Ruby on Rails, meaning hat I have Prototype on board, with which it seems to be conflicting. Look at http://www.magickblog.nl/account/login It now doesn’t display the text fields and buttons. How can I solve this? have been fruitlessly trying for days. Combining it with Jquery (also tried nicejforms) doesnt seemt to be an option, dosnt work nicely with prototype, it seems.
Thanx in advance for any suggestions.
- Adam Patterson
- April 19th, 2007
- 2:00 pm
is there any plans for upload/browse boutton style?
thanks
- Peter Kalman
- May 3rd, 2007
- 3:29 am
Hi Adam Patterson,
You must position a dummy input field governed by the old niceforms (the one that used classes instead of id-s) over the input field that has a type=”file”. Then all you need is a little javascript that swaps value-s between the original input field and the dummy input field. And of course place a button over the browse button to hide the original one. You need the old one for this because the workaround getElementByClass function that can be found on the net does not work :)
To make both versions of the niceforms work on the input field you just need to prevent the for cycle from placing the type=”file” input field into the array that holds the inputs. And use the old one’s hover function to govern the css of the input field.
It’s not pretty, but it works.
- Tom Stone Magiker
- May 7th, 2007
- 3:42 pm
Instead of Andrew’s solution in the function replaceSelects(), I added a isNaN after this line:
——————–
var selectWidth = parseInt(selects[q].className.replace(/width_/g, “”));
———————
Like this:
——————-
if(isNaN(selectWidth)) {selectWidth = 150;}
——————-
Also, as I have Niceforms on sliding Divs etc. I adjusted the following function like this:
—————————————
function showOptions(g) {
elem = document.getElementById(”optionsDiv”+g);
thething = document.getElementById(”sarea”+g); //Added
elem.style.left = findPosX(thething) + ‘px’; //Added
elem.style.top = findPosY(thething) + selectAreaHeight - selectAreaOptionsOverlap + ‘px’; //Added
if(elem.className==”optionsDivInvisible”) {elem.className = “optionsDivVisible”;}
else if(elem.className==”optionsDivVisible”) {elem.className = “optionsDivInvisible”;}
elem.onmouseout = hideOptions;
}
—————————————
Hope anyone find this useful
- jake
- May 10th, 2007
- 3:48 pm
hi, thank you so much for sharing this, it is really great work.
Question to anyone who may know answer:
If I center a website in the browser and use the niceforms option menu dropdown, when clicking to dropdown it works but then resizing or scaling window the layout moves but the dropdown stays in same place and does;t move with the layout, does ANYONE know how to fix this??
Again, thanks for sharing this, and any thoughts on this issue.
- elvelind grandin
- May 14th, 2007
- 1:02 pm
First of, great work. I’ve been waiting for 1.0 for some time now :)
Second. You wrote that there are more themes on the way. sooo, where are they? :)
- woto
- May 15th, 2007
- 7:26 pm
Hi, good deal, thanks!
I’ve made some changes, because there is some bug in IE 6.
You need to point cursor just on a text for selecting some Option in Select in difference from Firefox.
That’s why suggest to add 1 line at js
ater line 242
optionLink.style.width = selectWidth - selectLeftSideWidth - 1;
Sorry for my bad English, best whishes from Russia ;)
- woto
- May 16th, 2007
- 3:04 am
Hi again :)
There is another bug in IE 6.
When i click on text in Select there are no reaction, so i changed some code. Changes of previews post also included. Tested in FF 2.0.3, IE 6 and Opera 9.10
center.style.width = selectWidth - 10 + ‘px’;
center.style.cursor = “pointer”;
selectArea.style.width = selectWidth + selectRightSideWidth + selectLeftSideWidth + ‘px’;
button.style.width = selectWidth + selectRightSideWidth + selectLeftSideWidth + ‘px’;
button.style.marginLeft = - selectWidth - selectLeftSideWidth + selectLeftSideWidth + ‘px’;
button.href = “javascript:showOptions(”+q+”)”;
button.style.textDecoration = “none”;
button.onkeydown = selectEvent;
button.className = “selectButton”; //class used to check for mouseover
selectArea.className = “selectArea”;
selectArea.id = “sarea”+q;
left.className = “left”;
right.className = “right”;
center.className = “center”;
right.appendChild(button);
center.appendChild(text);
selectArea.appendChild(left);
selectArea.appendChild(right);
button.appendChild(center);
//hide the select field
selects[q].style.display=’none’;
//insert select div
selects[q].parentNode.insertBefore(selectArea, selects[q]);
//build & place options div
var optionsDiv = document.createElement(’div’);
optionsDiv.style.width = selectWidth + 1 + ‘px’;
optionsDiv.className = “optionsDivInvisible”;
optionsDiv.id = “optionsDiv”+q;
optionsDiv.style.left = findPosX(selectArea) + ‘px’;
optionsDiv.style.top = findPosY(selectArea) + selectAreaHeight - selectAreaOptionsOverlap + ‘px’;
//get select’s options and add to options div
for(var w = 0; w
- Tobi
- May 16th, 2007
- 1:09 pm
I wonder if there are already collections of themes contributed by someone ? Or a guide for own ones ?
- Chris
- May 16th, 2007
- 4:57 pm
Is there any chance someone has found a fix/explanation for the select box drop issues when used in close proximity to a textarea ? Check here for an example of my issue!
http://www.sorted.org.nz/calculators/my-goals/page1.php
Thanks in advance for any help on this!
- Alex
- May 19th, 2007
- 3:13 am
Hi Folks,
Although the script is great e.g. the on_Change-event for select boxes can’t be used. I made a very poor, not standard-compliant workarround:
put into the title-attribute what should be done onChange and insert a few lines into niceforms.js -> selectMe([…]) :
before the line //feed[…] :
value=selectField.value;
before the line //show selected […]:
if(value!= selectField.value) eval(selectField.title);
I have no bloody idea how to get the contents of the onChange-’property’.
If anyone know how. you’re welcomed to tell!
PS: Again, that script rules anyway!
- Lola
- May 25th, 2007
- 12:20 am
It looks really nice, thinking of implenting it. Good job, thank you for sharing.
- Walther
- May 29th, 2007
- 2:01 am
Hi & big thanks. Is there a PSD or something that enables me to extend your theme for Errormessages and stuff? This would be beneficial for other theme-authors as well.
- Richard K
- June 4th, 2007
- 12:10 pm
Loved this script … and REALLY LOVED Tom Stone’s solution for Internet F* Explorer.
Just missed the file field, but it still great!
Congratulations.
- TigreXMcbo
- June 9th, 2007
- 10:09 pm
Hi, write from venezuela, sorry for my english. I found this page: http://www.arraystudio.com/as-workshop/niceforms-with-even-nicer-select.html
where they explain how to fix certain problems with select, my friend Lucian Slatineanu to read that to include it in future versions or to give an idea of the possible solutions.
P.D. Saludos a todos y felicitaciones por esta iniciativa, espero alguien entienda español.
- DirkO
- June 15th, 2007
- 4:10 am
Great script!!
Did you make any progress re: multiple rows select fields and file input fields??
or maybe an option to exclude multiple rows select fields from being processed by your script because these are shown collapsed?
— dirko —
- Carolx
- June 17th, 2007
- 9:04 am
hjkkjk
Any ideas on how to make “select all” checkboxes work with this script? I tried applying the script to a forum, but when I click to check all boxes the images don’t change, although the hidden checkboxes are indeed selected.
- Ayodele
- June 18th, 2007
- 11:45 am
i love this script.
- Negligence
- June 25th, 2007
- 10:22 am
These forms look great, but there’s some quirks that will prevent you from using it. Mainly, the onchange event is not supported for Select lists. And you cannot disable checkboxes/radio buttons, which is a huge pain. If anyone has a solution to this it would be fantastic.
- dilog
- June 27th, 2007
- 3:44 am
i love this work, and i love the default skin too ;)
this is my first attempt to use it, but yet in minutes it’s all ok!
really good job
- Gilbitron
- June 29th, 2007
- 2:56 am
Hi, Great work. Im having a problem with drop down selects though. The further down my page they are, the smaller the top offset seems to go for the drop down div. Its strange. It does it in both IE and Firefox. See http://aessolar.awardspace.com/quote.php
- NesTT
- July 3rd, 2007
- 4:33 pm
Great script men, very cool and clean style :)
- games
- July 15th, 2007
- 1:30 am
I love the Niceforms script, and I�m very glad to see that it�s being updated and improved upon. So many scripts are just tossed out there and then not supported or debugged, so thanks for all of the work you�ve done to make Niceforms really work well. I love being able to customize the look of my forms without going through all sorts of trouble. One of the features I love the most is that the boxes highlight when you click on them � that makes it so much easier to fill out forms (especially long forms), I think, because users can tell exactly where they are on the page. I�ve also had a few interesting messages appear when I�ve used Niceforms, but thanks to you and everyone here, I�ve either found the solution I need or I�ve figured out ways around it. Again, thanks for all the hard work!
- GerManson
- July 17th, 2007
- 3:52 pm
I will be using this on my sites!! thank you, i think i love you.. of course. all credit to you.
- David
- July 23rd, 2007
- 9:37 am
Just wanted to mention that the Radio boxes do not seem to work when you have multiples of them on one page. At the moment I don’t have time to look through all the javascript code, but hopefully I can figure it out there.
Thanks!
- Civik
- July 25th, 2007
- 8:13 am
Tom Stone Magiker Very good solution !
Im creating an intranet with ajax and DIV´s with display=”none” / “” and this solve my problem.
Thankyou very much !
- Civik
- July 25th, 2007
- 8:47 am
Great problem with Events on Select Box,
I cant populate the next select box.
Something like Clear(); that can remove the skin, and then reload the Init();
Please badboy, help me ! ;-)
- Christian
- July 26th, 2007
- 8:15 pm
Everybody that has the problem with onchange or onclick:
Add after:
————————— optionsDiv.appendChild(optionHolder);
———————————————
This:
———————————————
if(selects[q].onchange){
optionLink.onclick=selects[q].onchange;
}else if(selects[q].onclick){
optionLink.onclick=selects[q].onclick;
}
And that function to your js:
function onChanged(){
document.FORMNAME.submit();
}
and at last add HTML example:
I hope it helps
- Chad
- July 31st, 2007
- 4:09 pm
This looks like an sweet solution. I have one question, out of all the samples I have seen for this it doesn’t look like anyone has taken into account a multi-select box and a select box with scrolling options. I.E. the select list is too long and starts to scroll.
Are these any solutions that you are working on fixing?
- ColdKeyboard
- July 31st, 2007
- 5:24 pm
Dude could you please post a .psd file of these icons/images that .js file uses so we can easily change this white background into something else… thanks in advance !
- Claire Matthews
- August 3rd, 2007
- 4:47 pm
Here’s now to make onchange work correctly in select lists:
In niceforms.js find the function ’selectMe’ (near line 268)
AFTER selectField=[…] add:
//save original value for onchange event
value = selectField.value;
AFTER textVar.replaceChild[…] add:
//fire the onchange event
if(value!=selectField.value) {eval(selectField.getAttribute(”onchange”).replace(/this.value/g, selectField.value));}
For some reason the eval was completing before the value had changed, hence the string.replace method to make sure ‘this.value’ has the right value.
- pp
- August 7th, 2007
- 1:18 pm
u are not a “bad” boy…change ur name to “good” boy.. thanks for sharing
- Paul Novik
- August 9th, 2007
- 6:44 am
In IE if have margin select options appears in incorrect position. There is my solution:
function findPosX(obj) {
var posLeft = 0;
while (obj.offsetParent) {posLeft += obj.offsetLeft; obj = obj.offsetParent;}
if(this.ie) posLeft += document.body.offsetLeft; //added
return posLeft;
}
- Kit
- August 12th, 2007
- 8:57 am
sorry ! i have use niceform with asp.net 1.1 and have some problem , can you demo niceform with asp.net 1.1 ? i very very thanks you !! im very very need it. please !
- RaL
- August 12th, 2007
- 6:05 pm
Can it work with validation (highlighting fields whats wrong)?
- hatman
- August 15th, 2007
- 6:45 am
Just amazing !
But a question, I’m using asp.net 2.0, how can I use the autopostback method of the select ?
Thanks for your help
BR
- Parisuhde
- August 19th, 2007
- 1:44 am
Thanks badboy for this great script and thanks Civik for the tip!
- Alex
- August 19th, 2007
- 5:09 am
Hi, im trying to integrate niceforms on a page that is also using tinymce. niceforms styling breaks tinymce so the question i have is that if there is any way to tell niceforms not to style a particular element? possibly by id or class. At the very least to tell it to stop styling textareas.
Any suggestions?
- Santosh Kumar
- August 19th, 2007
- 10:25 pm
On change event is not worked dropdown boxes
- canvas oil paintings
- August 23rd, 2007
- 11:45 pm
Is the problem on select options using Niceforms already solved? Since I’m using FF I can’t make use of Niceforms so far unless the problems on tab element switching and changing text size manually in FireFox aren’t solved yet.
- two.five.three.two
- August 25th, 2007
- 2:44 pm
Been using NiceForms since the last version and am lovin’ the new release. Just wanted to say thanks for the script and your hard work on them. Its very slick and clean and makes every form look very smooth.
- Carolyn M. Getting
- September 11th, 2007
- 12:42 pm
This is great and I love it. My forms are a little different, in that they are for a church. This made such a difference, I can hardly believe it.
God bless and thank you so very much.
- Sean Bannister
- September 12th, 2007
- 4:46 pm
Hey badboy,
I was just wondering if you minded me creating a drupal module to intergrate NiceForms into drupal.
- smusic
- September 23rd, 2007
- 3:43 am
Very good script!
The reset button is not reacting to your script and i cannot find a way to make it look ‘nice’ too.
Could you give me a hint on how to do this?
Thanx anyway.
Peter
- SGr33n
- September 27th, 2007
- 2:23 pm
Hey guys,
Change this in the CSS:
.buttonSubmit, .buttonSubmitHovered {
width: auto;
height: 26px;
color: #FFF;
font-weight: bold;
padding: 2px;
line-height: 100%;
background: url(’../images/button_bg.gif’) repeat-x left top;
cursor: pointer;
border: none;
}
Added: line-height: 100%;
The bug was on “button” and “submit” inputs, on Internet Explorer when you used Trebuchet MS as main font.
- SGr33n
- September 27th, 2007
- 3:40 pm
Errata Corrige: Doesn’t Work :\ i had to place the input submit in a DIV and class it font-family: Arial, Helvetica, sans-serif;
It seemed the only chance.
- tadaok
- September 28th, 2007
- 5:46 am
Hy… there is a little problem in the script
when a TEXTAREA or a INPUT is placed before an SELECT.
INPUTs move the SELECTBOX 4px to UP.
TEXTAREAs move the SELECTBOX 20px to down.
This is cumulative!!
If i put a select after 2 TEXTAREAs an 2 INPUTs my SELCTBOX will apear 32px lower(20+20-4-4=32).
- Bart Goossens
- October 1st, 2007
- 4:28 am
Change in JS for Niceforms
Had problems when loaded js in subfolder.
added following line
var fullRefPath = location.pathname;
and changed the line of the imagepath
var imagesPath = fullRefPath.replace(location.href.substring(location.href.lastIndexOf(’/')+1),”") + “inc/niceforms/images/”;
is working now
Thanks otherwise for the nicelayout.
- Xmion
- October 2nd, 2007
- 10:34 am
Should be nice to have niceform ported to jquery.
- Nick Toye
- October 3rd, 2007
- 6:38 am
This doesn’t work well with Firefox 2/Mac. None of the elements work at all.
- Nick Toye
- October 3rd, 2007
- 7:33 am
Actually it does work now, but its incredibly buggy.
Perhaps before a new version is released you should really think about documentation. Would really help those who use your code.
- Gérald
- October 4th, 2007
- 8:34 am
Thank you for this great job. Do you plan to provide a PSD file ? this would be really great.
- n37
- October 11th, 2007
- 3:23 am
Hi,
First of all, great work!
Searching the way to show up selects with scrollbar, i’ve found this http://blog.makemepulse.com/2007/07/04/niceforms-optimisation-and-new-features/ but this version still not work correctly as 1.0 does, expect for that i’ve said…
Can you please correct it and release the OFFICIAL niceforms v1.1? I’m considering to donate… :)
Many TIA. Best regards.
- Dominic
- October 16th, 2007
- 3:42 pm
Greetings. Thanks for the script.
Have been having some problems.
First of all, in IE6 the main part of the button where the text is that gets created is elevated higher than the left and right sides of the button. The only way thus far to get all 3 pieces of the button image to stick together is placing the form input field within a DIV tag, but besides being an awful workaround, it causes other problems. Wondering if someone had a solution to this, as others don’t seem to have this problem.
Next, I’m using AJAX with my web application and am also using a number of different JSPs to update different parts of the web application. When one part of the application is updated, a new call to init() inside the script file is obviously not made, so the styles are not applied to the new form elements upon update. If I force a call to init() through the updater with AJAX, the rest of the forms on the page that are not supposed to be updated are completely messed up.
Any thoughts? Thanks in advance.
- doubledutch
- October 18th, 2007
- 5:55 am
Hi there, i’m just a designer and the only thing i want to know: how can i use alpha transparent *.png images at the corners of a textarea or az input field? I read the rest of the comments but i didn’t find the solution for my problem :/
- Ilya
- November 1st, 2007
- 1:41 pm
I’ve made a small update for selectboxes to fix the problem with position. i.e. if you have a dynamic page content e.g. some div is expanded and the select box is moved, but the options were shown on the previous position.
Before the “build: function” I have added this, and call after any position changes:
update : function(options)
{
if(jQuery.NiceJForms.hasImages)
{
$(’div.optionsDivInvisible’).each(function(q)
{
var optionsDiv = document.getElementById($(this).attr(’id’));
var optionsPosition = document.getElementById(’sarea’+q);
var getPosition = jQuery.iUtil.getPosition(optionsPosition);
jQuery(optionsDiv)
.css({
left : getPosition.x,
top : getPosition.y + jQuery.NiceJForms.options.selectAreaHeight - jQuery.NiceJForms.options.selectAreaOptionsOverlap + ‘px’
})
}
);
}
},
- Max B.
- November 9th, 2007
- 12:01 pm
Implemented Niceforms this afternoon, but ran into an issue. I’m using Calendar Date select control based on the prototype framework in some of my forms. The control uses a small image with an onclick event to pop up the calendar. After implementing Niceforms clicking on the image to bring up the calendar no longer works.
Here’s the home page for the control:
http://code.google.com/p/calendardateselect/
If anyone can take a look and suggest a solution I’d greatly appreciate the effort!
Many thanks and, of course, great work!
- Sebastiano
- November 9th, 2007
- 4:04 pm
kudos for the script, looks really nice, if you need help with further development of the script contact me, and I’ll see how I can help you with it, I’m sure I can find some time to help you out.
- Gabriel
- November 12th, 2007
- 6:39 pm
is not Valid XHTML 1.0 Strict =( …
- Jano Rubio
- November 15th, 2007
- 11:34 am
I agree that it would be nice to see an official release of Niceforms 1.1, adding the useful bugfixes provided at http://blog.makemepulse.com/2007/07/04/niceforms-optimisation-and-new-features/
I found that you can attach both this site’s Niceforms, followed by the above “bug-fix” file, and get most things functioning.
Note: The unofficial bug-fixes come with slightly tweaked images, so be careful to integrate them with your existing images folder.
All that being said, this is so far a very nice solution. Lucien, have you considered attaching a wiki page here so that folks like us can add documentation?
- Sean Bannister
- November 22nd, 2007
- 10:29 pm
Yeah I agree with n37, it’s would be great to update the official Niceforms with some of the features seen at http://blog.makemepulse.com/2007/07/04/niceforms-optimisation-and-new-features/. I had a look at the code makemepulse had created and it’s a bit strange. But the features are good.
- Dan
- November 26th, 2007
- 10:02 pm
Great article! Love the forms!
- Clint
- November 27th, 2007
- 8:34 am
i’m using firefox 3 (mac) and firefox 2 (win) and i only get the radio/checkboxes to work when i click on the wording next to it, even though the mouse indicates i can click on the object itself. so clicking the actual check box does nothing. the select box also only works when i click on the down arrow, not the words, as it does in IE
- Ramwell
- December 5th, 2007
- 8:02 pm
How about sizes in em’s(procents) for flexible designs? It would be pretty, if forms element were more controled by css rules and a lower connected with absolute sizes. Can you recommend (or just list :) here any other public solutions for modding forms exept yours? Gess it would be help many visitors of your site, come here by googling information about solving the problem of modding forms.
- stan
- December 14th, 2007
- 8:01 am
In the message about onchange ()
* Claire Matthews
* August 3rd, 2007
* 4:47 pm
There is a problem - a mistake in IE 6 and if value there is a text then it is necessary to add it:
if(value != selectField.value) {eval(selectField.getAttribute(’onchange’).replace(/this.value/g, “‘” + selectField.value + “‘”));}
- diego
- December 14th, 2007
- 9:43 am
hi,in explorer v7 it functions perfectly,but in mozilla 5.0 it doesn’t work.
Someone has the same problem?
Bye!
- sharp aquos
- December 19th, 2007
- 1:32 pm
Been using NiceForms since the last version and am lovin’ the new release. Just wanted to say thanks for the script and your hard work on them.
- syfo
- December 20th, 2007
- 11:50 pm
is there a way to clear the default value of text fields when the text input is selected?
- Arain
- December 21st, 2007
- 3:00 pm
Wow. It’s fantastic work!
but you forgot to beauty the upload button .
eg:
could you fix this in next version ? Best regards.
- VIPStephan
- December 25th, 2007
- 11:27 am
Nice thing this niceform. :-)
However, I’m wondering why you’re adding the select options to the body and not to the respective form element as this would make positioning them way easier. My problem is that my form is positioned at the right side (i.e. staying at the same position at the right when resizing the browser window) and the options are positioned at the left, so when I resize the window after the page is loaded the options stay where they are while the form moves. The trick here is to change findPosX() to get the “offsetRight”. However, as I’m not too JS savvy, can anyone tell me how one would do that?
Or, for future releases, it would be best if the options would be appended as children of the respective form, not the body.
- Kent R
- December 30th, 2007
- 12:18 am
Can you get around the safari limitations by using the negative margin method for text boxes and text areas and replacing submit & button inputs with the element?
Negative margin method:
http://www.waytoocrowded.com/2007/04/19/safari-input-border-control/
- Anders
- January 2nd, 2008
- 11:59 pm
The Niceforms works perfectly in IE7, but I don’t get it to work at ALL in FireFox… Help anyone? :-)
- Hairdressers
- January 10th, 2008
- 4:00 am
Love the dropdowns. Think that is the highlight.
Thanks for sharing this with us.
Wow! This has turned out really nice! Great job!