I have a HTML form which has radio inputs range from 1 to 5:
<input type="radio" name="num" value="1" checked>1
<input type="radio" name="num" value="2">2
<input type="radio" name="num" value="3">3
<input type="radio" name="num" value="4">4
<input type="radio" name="num" value="5">5
I want to convert it into a rating widget. I found a very good post with an example to convert radio inputs into a star rating widget.
Code by Stephen Morley – A star rating widget using CSS
But instead of rating by stars, i would like to create a number rating widget. So i modified the example a bit. First, create a image as follow.
Continue reading CSS – Number rating widget
Most common task in Drupal development is creating or altering forms. It could save a lot of CSS code if we group the form fields in div.
Here is an example.
Continue reading Drupal 7 – Group form fields in div
Add the following form element in hook_form_alter() to add your own HTML markup.
$form['html_markup'] = array('#markup' => t('<a href="http://eureka.ykyuen.info">Eureka!</a>'));
For Drupal 6, please refer to the following post instead.
Drupal – Add HTML Markup in Form
Reference: Drupal 7 Form API Reference
Yesterday we talked about styling the checkbox and radio button as suggested by Ryan Fait.
Here is a simple solution for applying the checkbox and radio button in Drupal 7 webform.
1. Upload the radio.png, checkbox.png and select.png to your subtheme. (Omega subtheme is used in this example.)
Continue reading Drupal 7 – Styling checkbox and radio button in Webform
I want to style the form elements such as radio button, checkbox or selection list. Google shows me a very good tutorial written by Ryan Fait.
Las Vegas Web Design – Checkboxes, Radio Buttons, Select Lists, Custom HTML Form Elements
In the above tutorial, those form elements will be replaced by a span element. It works great. Only 1 minor problem which is those span elements could not align well. So i made some change on the CSS. Here is my example.
Drupal provides a powerful form API for form generation. In this post, i will show you how to create a simple form and log it in watchdog whenever the form button is clicked.
First of all, let’s create a new module, name it as custommod and implement the following 2 functions. Continue reading Drupal – Create a Simple Form