Sugarcrm changing color of checkbox when ticked - sugarcrm

I have a questionnaire setup in SugarCRM. I would like to change color of label when the checkbox is ticked. I added following custom code:
'customCode' => '<span style="color: red">{$fields.interest_c.value}</span>',
But all i get is a 1 or a 0 in red color.

You should add it like this:
'customCode' => '<input type="checkbox" id="interest_c" name="do_not_call" value="{$fields. interest_c.value}" title="" tabindex="0">'
and set the class for your color using the same accessor.

Related

Material-ui color of components is only primary and secondary

<Button variant="contained" color="success">save</Button>
<Button variant="contained" color="error">delete</Button>
Both buttons show the default color.
Most components behave the same way: success, info... none of them work as I expect them to.
I know this is not a bug, according to the API documentation, MaterialUI's components simply don’t recognize other palette's colors at all, but this bugs me.
Why components only recognize primary and secondary colors?
How should I use the colors of my theme.palette so that they are applied to my components?
Is changing the theme my only option to achieve the effect I am looking for?
According to the Button API documentation, the accepted values for the color prop are 'default', 'inherit', 'primary' and 'secondary' only. Therefore, Material UI will not recognize color='success' nor color='error' and show the corresponding colors.
I assume you are trying to use the success and error colors from the default theme. In the default theme object, the colors for success and error can be found in theme.palette.success and theme.palette.error respectively.
Therefore, we can access the default theme colors using the following way:
const useStyles = makeStyles((theme) => ({
success: {
backgroundColor: theme.palette.success.main
},
error: {
backgroundColor: theme.palette.error.main
}
}));
export default function ContainedButtons() {
const classes = useStyles();
return (
<div>
<Button variant="contained" classes={{ root: classes.success }}>
Save
</Button>
<Button variant="contained" classes={{ root: classes.error }}>
Delete
</Button>
</div>
);
}

How to render ion-checkbox dynamically in Ionic 3?

I want to render ion-checkbox dynamically in my html page. I tried using below:
In .ts file:
sanitizeLetterBody = (letterBody): string => {
let replaceText = "<ion-item><ion-label><b>Read and approved with initials below. </b></ion-label><ion-checkbox class='letter-initials'></ion-checkbox></ion-item>";
return letterBody.split("#PAT_SIGN_INITIAL#").join(replaceText);
}
In .html file:
<ion-row>
<ion-col class="padding-top-10 padding-left-0 padding-right-0 padding-bottom-0">
<div class="letter-body white-space-pre-line" [innerHTML]="customLetterData.LetterBody | safeHtml:'html'"></div>
</ion-col>
</ion-row>
But, the checkbox did not render in the html page like below:
Then i tried using <input type='checkbox'> like below:
sanitizeLetterBody = (letterBody): string => {
let replaceText = " <input type='checkbox' class='check-pat-initials' name='test'><b>Read and approved with initials below.</b> ";
return letterBody.split("#PAT_SIGN_INITIAL#").join(replaceText);
}
The checkbox is rendered nicely but i can't check or un-check the checkbox. May be no events are binding in this fashion.
Why can't i check or un-check the checkbox which are rendered dynamically?
Is there any different approach to achieve this?

Wicket CheckBoxMultipleChoice

How to change css style of Rendered html of CheckBoxMultipleChoice? CheckBoxMultipleChoice renders this html output by default but i want to change css style of this rendered output
<div class="ca-info__cat-roles js-roles-1 expanded" wicket:id="categories" id="categoriesb">
<input name="categories" type="checkbox" value="819" id="categoriesb categories_819">
<label for="categoriesb-categories_819">index>root>CategoryCatalog.png>9</label>
<input name="categories" type="checkbox" value="829" id="categoriesb-categories_829">
<label for="categoriesb-categories_829">index>root>tv.png>9</label>
</div>
I want to change styles of inputs and labels, but i don't know how to do it with CheckBoxMultipleChoice.
I have done this way. There are two ways
Add CSS in html page itself . inside style tag add your style like below but this will affect other component if you have same style.
.ca-info__cat-roles js-roles-1.expanded label{
// Your style for label
}
.ca-info__cat-roles js-roles-1.expanded input{
// Your style for input
}
2.Another way You can override#appendHtml and derive your own style for check box (e.g)buffer.append("class=\"yourStyleclass\"");.
In addition to use custom css for you component you have to use setSuffix() and setPrefix() methods, like this:
checkboxes = new CheckBoxMultipleChoice<>("checkboxes", value);
checkboxes.setSuffix("<br/>");

Laravel Form: Input Button Not Showing HTML Icon

I'm creating a button with Form at Laravel:
{!! Form::submit('<i class="fa fa-trash"></i>', ["class"=>"btn btn-default"]) !!}
The button text becomes:
<i class="fa fa-trash"></i>
I see only this string, not the icon: how to fix it?
Try to use Form::button instead of Form::submit:
{{ Form::button('<i class="fa fa-trash"></i>', ['type' => 'submit', 'class' => 'btn btn-default'] ) }}
It will create a button tag with type submit instead of an input tag.
This way the html of the icon should be rendered inside the tag content and should be visible.
Instead, by using an input tag like you are doing, the html string of the icon would be printend inside the value attribute of the input tag, and here it couldn't be rendered as valid html

setting popup box value based on the specific link clicked

I have a slider gallery it contains links below the image. I want to
show a popup box with a form and the name of the image to be auto
selected in the popup form.
I have done till this
the popup box is appearing on the link clicked. I have also set the
link with value like this :
<a href="#?id=1" data-reveal-id="myModal" data-animation="fade" >Make an enquiry</a>
This is the code through which i am fetching the value of the link
<?php
if (isset($_GET['id'])){
if($_GET['id']=='1')
echo '<td><input type="text" name="product" style="width:200px; height:30px; !important" value="Testvalue"></td></tr>';
}
else{
echo '<td><input type="text" name="product" style="width:200px; height:30px; !important" ></td></tr>';
}
?>
But I am getting a blank textbox .. Where am I going wrong ???
It should be