Drupal: Display poll radio to Button and show result on click of choice

×

Error message

  • Deprecated function: Return type of DatabaseStatementBase::execute($args = [], $options = []) should either be compatible with PDOStatement::execute(?array $params = null): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2244 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseCondition::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 1652 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property MergeQuery::$condition is deprecated in MergeQuery->__construct() (line 1344 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).

This CodeLet will Dispaly poll choice radio as a Button and view result on click of button.

Drupal: Poll radio to Button
CodeLet: 

custom.css file


.vote-form input[type="radio"].form-radio, .vote-form #edit-vote {
display:none;
}
.vote-form input[type="radio"].form-radio + label{
background-image: -moz-linear-gradient(bottom,#BCBCBC,#AAAAAA);
background-image: -webkit-gradient(linear,0 0,0 100%,from(#BCBCBC),#AAAAAA);
background-image: -webkit-linear-gradient(bottom,#BCBCBC,#AAAAAA);
background-image: -o-linear-gradient(bottom,#BCBCBC,#AAAAAA);
background-image: linear-gradient(to top,#BCBCBC,#AAAAAA);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffBCBCBC',endColorstr='#ffAAAAAA',GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-webkit-box-shadow: inset 0 1px 6px rgba(41, 41, 41, 0.2),0 1px 2px rgba(0,0,0,0.05);
-moz-box-shadow: inset 0 1px 6px 0 rgba(41, 41, 41, 0.2),0 1px 2px rgba(0,0,0,0.05);
box-shadow: inset 0 1px 6px rgba(41, 41, 41, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);
cursor: pointer;
color: #FFFFFF;
font-weight:bold;
border-color: transparent;
text-shadow: 0 1px 1px rgba(40, 40, 40, 0.75);
border-radius:5px;
padding:5px
}

.vote-form input[type="radio"].form-radio:checked + label {
background-image: -moz-linear-gradient(bottom,#969696,#727272);
background-image: -webkit-gradient(linear,0 0,0 100%,from(#969696),#727272);
background-image: -webkit-linear-gradient(bottom,#969696,#727272);
background-image: -o-linear-gradient(bottom,#969696,#727272);
background-image: linear-gradient(to top,#969696,#727272);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff969696',endColorstr='#ff727272',GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-webkit-box-shadow: inset 0 1px 6px rgba(41, 41, 41, 0.2),0 1px 2px rgba(0,0,0,0.05);
-moz-box-shadow: inset 0 1px 6px 0 rgba(41, 41, 41, 0.2),0 1px 2px rgba(0,0,0,0.05);
box-shadow: inset 0 1px 6px rgba(41, 41, 41, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);
cursor: default;
color: #FFFFFF;
font-weight:bold;
border-color: transparent;
text-shadow: 0 1px 1px rgba(40, 40, 40, 0.75);
border-radius:5px;
padding:5px

}

.vote-form input[type="radio"].form-radio + label {
width: 3em;
}

.vote-form input[type="radio"].form-radio:checked + label.btn:hover {
background-color: inherit;
background-position: 0 0;
-webkit-transition: none;
-moz-trainsition: none;
transition: none;
}

custom.js

jQuery(document).ready(function(){

jQuery(".vote-form input[type=\"radio\"].form-radio").click(function(){
jQuery(this).closest("form").submit();
});
});

Info file details: 

name = Custom
description = Custom feature
core = 7.x
package = custom
scripts[] = custom.js
stylesheets[all][] = custom.css

Compatibility: 
Is CodeLet useful?: 
Drupal: Display poll radio to Button and show result on click of choice | Drupal Developer

Error

The website encountered an unexpected error. Please try again later.