Button not adhering to CSS

Hello,

I've got a button with very simple CSS (below).  Problem is, the button isn't adhering to the code:

{$this field rule} input;
input[type="button"]{
height: 50px;
width: 50px;
}
input[type="button"]:disabled{
background: #dddddd;
}

On both the form editor and the form in use, it's not following the dimensions

 Form Editor - not square

 On Form when viewing ItemType

The button activates a method which is working as expected, so my only issue is the size of the button isn't doing what I want.

As an alternate, I tried using an HTML field with my code to run a script, but the script doesn't seem to work on "onclick" for the HTML field; though the HTML formatting shows up as expected.

Code below:

<html>
<body>

<input type='button'
onClick="function(VHVL)"
style="height:40px;
width:40px;
background-color: RGBA(255, 255, 0);
border: 1px solid RGBA(128, 128, 128, 0.5);
padding: 0.25em;">

<script>

function (VHVL) {

// Create an Innovator object

var myInnov = new Innovator();

var riskprobability = "1";
var riskimpact = "1";

var probabilityDropdown = getFieldComponentByName('_riskprobability');
probabilityDropdown.component.setState({value: riskprobability});
window.handleItemChange("_riskprobability", riskprobability);

var impactDropdown = getFieldComponentByName('_riskimpact');
impactDropdown.component.setState({value: riskimpact});
window.handleItemChange("_riskimpact", riskimpact);

var SeverityScore = riskprobability * riskimpact

window.handleItemChange("_riskseverityscore", SeverityScore)

if (riskimpact >= 4 && riskprobability <= 2) {
window.handleItemChange("_riskhilp", "1");
}
else
{
window.handleItemChange("_riskhilp", "0");
}

if (SeverityScore > 4) {
window.handleItemChange("_riskromap", "1");
}
else
{
window.handleItemChange("_riskromap", "0");
}
}
</script>

</body>

</html>

I don't really care whether I do this as a button or as an HTML field, but I do need the "item" to look right and execute the code.  Appreciate any help on this!

Parents
  • Regarding Aras buttons:

    Which tab do you use to do your styling? Field CSS or Form CSS?
    1. Your first code works in 'Form CSS' (overall Form styling) when you remove {$this field rule} input; . 
    2. Your first code works in 'Field CSS' (individual element styling) when you remove input[type="button"] ;

    Regarding html buttons.

    Your button html code contains multiple errors. Your function call is creative (but wrong :-) ) and you mix ' with ". Compare with this one:

    <input type="button"
      onClick="myfunction();"
      style="height:40px;cursor:pointer;width:40px;"
    <script>

    function myfunction() {
      alert("x");
    }
    </script>

    Instead of using tons of buttons, I personally would use a html table for this use case. Harder to design, but a lot easier to maintain. Of course a matter of taste.Grin

  • Thank you!  I got it working with an HTML table and got color changes on click like I wanted.  Now just need to take the dropdown events and have them update/select the right cells in the HTML table.

    Appreciate it!

Reply Children
No Data