Style radio buttons symfony - radiobuttonlist

I'm trying to style some radio buttons that are in a list but when I declare input["type=radio"]{ border-style: none; } in the CSS file it does nothing.
Here is the code where the radio buttons are:
<?php echo $form['servico_id']; ?>.
The servico_id is a list with six radio buttons options from the form new.
Can you help me? I hope I've explained myself well.
Thank you
the form newSuccess:
<form action="<?php echo url_for('marcacao/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id='.$form->getObject()->getId() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
<div id="sub-titulo">Dados Pessoais</div>
<div class="sombra">Nome
<?php echo $form['nome']; ?>
<?php echo $form['id']; ?>
<?php echo $form['_csrf_token']; ?>
</div>
<div class="sombra">E-mail
<?php echo $form['email']; ?>
</div>
<div class="sombra">Contacto
<?php echo $form['contacto']; ?>
</div>
<div id="sub-titulo">Preferência Horária</div>
<div class="sombra"> Dia<?php echo $form['dia']; ?> Hora<?php echo $form['hora']; ?></div>
<div id="sub-titulo">Serviços</div>
<?php echo $form['servico_id']; ?>
<input type="submit" name="submit" value="Marcar >"/>
</form>
</div>

It looks as though you are putting JQuery selector syntax in your css file. This is not
correct. Instead either tag your input type="radio" elements with a CSS class and style that class in your css file, or add a javascript block to style your elements using jQuery.
ie. CSS file:
input.radio {
background-color: blue; //style as you wish
}
ie. HTML:
<input type="radio" class="radio" /> Yes
<input type="radio" class="radio" /> No
Or the alternative way (using JQuery/Javascript):
<script type="text/javascript">
$(function() {
$("input:radio").css('background-color', 'blue);
});
</script>

You could handle it with symfony like this :
Give your radio input a css class within the symfony form configure() function
$this->widgetSchema["myradio"]->setAttribute("class" => "mySpecialRadio");
Put your styling in corresponding css file
/* If you use ul/li rendering of sfWidgetFormChoice */
li.mySpecialRadio {
color: red;
}
input[type="radio"].mySpecialRadio {
float: right;
}

Related

How to show html form using shortcode in wordpress?

I want to show html form using shortcode. Here is my code:
add_shortcode('sms_order_form', 'sms_order_form_html');
function sms_order_form_html(){?>
'<form>
<div class="tooltip">
0<input type="range" id="range" value="0" min="0" max="100"/>100
<span class="tooltiptext">0</span>
</div>
</form>
<?php } ?>
But this doesn't print the form. but if I replace the HTML form by echo 'hello'; it prints hello. Is there any way to show any HTML using shortcode.
N.B.: shortcode is placed using elementor.
Shortcode should return a string:
<?php
add_shortcode( 'sms_order_form', 'sms_order_form_html' );
function sms_order_form_html() {
ob_start();
?>
<form>
<div class="tooltip">
0<input type="range" id="range" value="0" min="0" max="100"/>100
<span class="tooltiptext">0</span>
</div>
</form>
<?php
return ob_get_clean();
}
Shortcode functions need to return the output in form of a string as opposed to outputting HTML right away. You can use output buffering to return your code like so:
add_shortcode('sms_order_form', 'sms_order_form_html');
function sms_order_form_html() {
ob_start();
?>
<form>
<div class="tooltip">
0<input type="range" id="range" value="0" min="0" max="100"/>100
<span class="tooltiptext">0</span>
</div>
</form>
<?php
return ob_get_clean(); // clear the output buffer, and return as string
}

Concrete5 add sub page (page not found)

I try to add sub page of home page. After i clicked add page button, it redirects to page not found. This happened also when I tried to log in via custom login page, but then I created new controller, and it works. I guess they are a similar problem.
This is the form to add page. The action value is http://rc.bappenas.go.id/index.php?cID=5023&ccm_token=1441182812:061784e9bfe5b07adb7e5c876e010d09
<form method="post" action="<?php echo $c->getCollectionAction()?>" id="ccmAddPage" onsubmit="jQuery.fn.dialog.showLoader()" class="dialog-form">
<input type="hidden" name="rel" value="<?php echo $_REQUEST['rel']?>" />
<input type="hidden" name="ctID" value="<?php echo $_REQUEST['ctID']?>" />
<div id="ccm-add-page-information">
<h4><?php echo t('Standard Properties')?></h4>
<?php $form = Loader::helper('form'); ?>
<div class="clearfix">
<?php echo $form->label('cName', t('Name'))?>
<div class="input"><input type="text" name="cName" value="" class="text span6" onKeyUp="ccm_updateAddPageHandle()" ></div>
</div>
<div class="clearfix">
<?php echo $form->label('cHandle', t('URL Slug'))?>
<div class="input"><input type="text" name="cHandle" class="span3" value="" id="cHandle">
<img src="<?php echo ASSETS_URL_IMAGES?>/loader_intelligent_search.gif" width="43" height="11" id="ccm-url-slug-loader" style="display: none" />
</div>
</div>
<div class="clearfix">
<?php echo $form->label('cDatePublic', t('Public Date/Time'))?>
<div class="input">
<?php
$dt = Loader::helper('form/date_time');
echo $dt->datetime('cDatePublic' );
?>
</div>
</div>
<div class="clearfix">
<?php echo $form->label('cDescription', t('Description'))?>
<div class="input">
<textarea name="cDescription" rows="4" class="span6"></textarea>
</div>
</div>
<?php
$attribs = $ct->getAvailableAttributeKeys();
$mc = $ct->getMasterTemplate();
?>
<?php if (count($attribs) > 0) { ?>
<h4><?php echo t('Custom Attributes')?></h4>
<?php
ob_start();
foreach($attribs as $ak) {
if (is_object($mc)) {
$caValue = $mc->getAttributeValueObject($ak);
}
?>
<div class="clearfix">
<label><?php echo $ak->getAttributeKeyName()?></label>
<div class="input">
<?php echo $ak->render('composer', $caValue); ?>
</div>
</div>
<?php }
$contents = ob_get_contents();
ob_end_clean(); ?>
<script type="text/javascript">
<?php
$v = View::getInstance();
$headerItems = $v->getHeaderItems();
foreach($headerItems as $item) {
if ($item instanceof CSSOutputObject) {
$type = 'CSS';
} else {
$type = 'JAVASCRIPT';
} ?>
ccm_addHeaderItem("<?php echo $item->file?>", '<?php echo $type?>');
<?php
}
?>
</script>
<?php print $contents; ?>
<?php } ?>
</div>
<div class="dialog-buttons">
<?php echo t('Cancel')?>
<input type="submit" onclick="$('#ccmAddPage').submit()" class="btn primary ccm-button-right" value="<?php echo t('Add Page')?>" />
</div>
<input type="hidden" name="add" value="1" />
<input type="hidden" name="processCollection" value="1">
</form>

Add Scroll Bar and select image instead of radio buttons

I created an options field on my WordPress options page. My field contains 36 images for patterns of my body theme. All things work perfectly.
How can I add a scroll bar to my options field until it only shows some images, then by scrolling shows other images?
How can I hide radio buttons and select images instead on radio buttons?
This is my code
function YPE_body_pattern_callback() {
?>
<div>
<h3>Choose Pattern</h3>
<?php
$checked = 'checked="checked"';
$YPE_options = get_option( 'YPE_post_option_name' );
?>
<ul class="list-inline">
<?php for($i=1 ; $i<=36 ; $i++ ){
$pattern = 'body-bg'.$i; ?>
<li>
<input name="YPE_post_option_name[YPE_body_pattern]" type="radio" value="<?php echo $pattern ?>" <?php if($YPE_options['YPE_body_pattern'] == $pattern ) echo $checked; ?> />
<a href="#">
<img src="<?php echo get_template_directory_uri(); ?>/panel/images/patterns/<?php echo $pattern ?>.png" />
</a>
</li>
<?php } ?>
</ul>
</div>
<?php
}
I solved my problem by using the overflow:scroll;width:300px; CSS property for adding scroll bar by 300px height.

Add result from a function in a HTML form

I have the following PHP code which is a template page for a wordpress site:
<?php
/*
Template Name: Calculator Form
*/
get_header(); ?>
<div id="content" class="grid_7 suffix_1 <?php echo of_get_option('blog_sidebar_pos') ?>">
<FORM action="<?php bloginfo('template_directory'); ?>/function.php" method="post">
<INPUT TYPE="text" NAME="inputbox" VALUE="" style="width:200px;" />
<INPUT TYPE="button" NAME="button" Value="Calculate" style="width:200px;" />
<INPUT TYPE="text" NAME="result" VALUE="" disabled style="width:200px;" />
</FORM>
</div><!--#content-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
For arguments sake, let's say that the function.php file looks like:
<?php
function calculate($value)
{
return $value / 1000;
}
calculate($_POST['inputbox']);
?>
I want to add the result of this function into the result field in the form.
I'm not sure if this is a WordPress thing. If I were doing this, I would avoid the functions.php and either use some Javascript to output the calculation or PHP within the template to display the result. Since you are leaning more toward PHP:
<?php
if( $_POST['submit'] ) :
$result = $_POST['inputbox'] / 1000;
else :
$result = "";
endif;
?>
<form action="<?php the_permalink(); ?>" method="post">
<input type="text" name="inputbox" value="" style="width:200px;" />
<input type="submit" name="submit" value="Calculate" style="width:200px;" />
<input type="text" name="result" value="" disabled style="width:200px;" />
<input type="text" name="result" value="<?php echo $result; ?>" disabled style="width:200px;" />
</form>
(Untested)

changing the logo based on .css file

I have this code in my header.php :
<div id="logo">
<?php if( get_option('of_logo') != '') { ?>
<a class="image" href="<?php echo get_option('home'); ?>/" title="Home">
<img src="<?php echo get_option('of_logo'); ?>" />
</a>
<?php } else { ?>
<h1 class="front-page-logo"><?php bloginfo('name'); ?></h1>
<h2><?php bloginfo('description'); ?></h2>
<?php } ?>
</div>
All works great! basically it says if the user uploads a logo image in the theme options panel, then show that image, else, show some text.
Now I need to replace this:
<?php } else { ?>
<h1 class="front-page-logo"><?php bloginfo('name'); ?></h1>
<h2><?php bloginfo('description'); ?></h2>
<?php } ?>
with display a image based on the style.css the user choose. And my problem here is if I go to each css file and declare a diferent image, then if the user uploads a image also, both images show on page.
So how can I do that?
thanks
Use a an id or class on your default logo and declare the image urls in the various css files using background-image:
<?php } else { ?>
<div id="default-logo"></div>
<?php } ?>
In the css files:
#default-logo {
background-image: url(".../1.jpg");
width: 80px;
height: 80px; /* the dimensions of your logo */
}

Resources