Arithmetic Operation in Thymeleaf - html

How can I do some arithmetic operation in thymeleaf. I have tested so many ways. But unable to get the output. If U know, Please let me know.
Here is my code:
/*Dummy Content */
<p class="quan-inc-dec">
<input type="hidden" name="productId" th:value="*{product.id}" class="productId"/>
<input type="hidden" name="orderItemId" th:value="*{id}" class="orderItemId"/>
<input type="button" name="minus" class="minus" value="-" autocomplete="off"/>
<input type="text" name="quantity" value="1" class="result" autocomplete="off" th:value="*{quantity}"/>
<input type="button" name="plus" class="plus" autocomplete="off" value="+"/>
</p>
/*Dummy Content End*/
<span th:text="${${obj.baseRetailPrice}*${obj.aa}}"><!-- I need the Result Here --></span>

Like this:
<div th:with="result=${obj.baseRetailPrice * obj.aa}">
<span th:text="${result}"></span>
</div>

Related

How to validate individual fields on button click in angular js as we do in JQuery

As we have number of input fields and there are some fields as required example:
<input placeholder="Role" type="text" required/>
<span ng-show="Role" class="text-danger">Role is required.</span>
<input placeholder="Title" type="text" required/>
etc..
<button type="button" ngclick="Savereferences()">Save</button>
Now i want to validate this fields on click of Save button in angular js, Can any one help me out how to do this.
<input placeholder="Role" ng-model="Role" type="text" required/>
<span ng-show="RoleMsg" class="text-danger">Role is required.</span>
<input placeholder="Title" ng-model="Title" type="text" required/>
etc..
<button type="button" ngclick="Savereferences()">Save</button>
JS Code for validating Role
$scope.Savereferences=function(){
if($scope.Role){
$scope.RoleMsg=true;
}
}
You can do like this...using ng-required and form
<form role="form" id="form" name="form" class="form-horizontal">
<input placeholder="Role" id="role" name="role" type="text" ng-required="true"/>
<span ng-show="form.role.$error.required">Role is required.</span>
//Same as other field
<button type="button" ng-disabled="!form.$valid" ngclick="Savereferences()">Save</button>
</form>

Firefox tabindex not following source order

Tabbing on Chrome follows the source order for this form nicely, whereas Firefox skips the password reset link, and goes straight to the next thing after the form, which is a button. Does Firefox prioritise buttons and form elements over links for tabindexing? It doesn't make any difference what tabindex number I put on the link
<form method="POST" action="/login" accept-charset="UTF-8">
<label><span class="element-invisible">Email address</span>
<input placeholder="Email address" name="login_email" type="email">
</label>
<label><span class="element-invisible">Password</span>
<input placeholder="Password" name="login_password" value="" type="password">
</label>
<input class="buttonNoStyle submitButtonSolid" value="Login" type="submit">
<div class="underForm">
<input id="rememberMe" name="remember" class="element-invisible" value="all" checked="" type="checkbox">
<label class="rememberMe" for="rememberMe">
Remember me
</label>
<div class="forgot">| <a tabindex="1" class="forgotLink" href="/password/reset">Forgotten password</a></div>
</div><!-- /underForm -->
</form>
<button type="button" class="buttonNoStyle standardButton thinnerButton whiteButton" id="logIn2">Log in</button>

Align textbox and button

I have two textbox and one button in a popupbox.
I want to make button exactly below the two textbox ,
wherein in my code it is not happening. Please help
HTML COde :::
<form method="post" action="index.html">
<p><input type="text" name="login" value="" placeholder="Username or Email"></p>
<p><input type="password" name="password" value="" placeholder="Password"></p>
<p class="remember_me">
<label>
<input type="checkbox" name="remember_me" id="remember_me">
Remember me on this computer
</label>
</p>
<p class="submit"><input type="submit" name="commit" value="Logine" class="marginleft5"></p>
<!-- <div class="login-help">
<p>Forgot your password? Click here to reset it.</p>
</div> -->
</form>
Use <div> tags for lines, or otherwise use <br/> to break line

Can't see the send button in HTML contact form

I'm trying to make a simple HTML contact form, but when I upload the HTML page to the internet, the send and clear buttons are not showing up - they're invisible.
The funny thing is if I hover the mouse over where they are supposed to be, I can see that there is a button there.
Why could this be?
<form action="contact.php" method="post">
<div>
<label for="contactname">Name</label>
<input type="text" name="contactname" class="textfield" id="contactname" value="" />
<span class="require"> *</span>
<label for="contactsubject">Subject</label>
<input type="text" name="contactsubject" class="textfield" id="contactsubject" value=""/>
<span class="require"> *</span>
<label for="contactemail">Your E-mail</label>
<input type="text" name="contactemail" class="textfield" id="contactemail" value="" />
<span class="require"> *</span>
<label for="contactmessage">Your Message</label>
<textarea name="contactmessage" id="contactmessage" class="textarea" cols="8" rows="12"></textarea>
<span class="require"> *</span>
<input type="submit" value="Send">
<input type="reset" value="Clear">
add / end slash to both send & clear
<input type="submit" value="Send"/>
and
<input type="reset" value="Clear"/>
or you can also do like this:
<input type="submit" value="Send"></input>
<input type="reset" value="Clear"></input>
<input> is starting tag
</input> is ending tag
UPDATE 1: answer for how to use image for submit button
change input type to "image"
<input type="image" value="submit" src="submit1.jpg" alt="submit Button" onMouseOver="this.src='submit1.jpg'">

CSS style=display:block not working

Browser is Firefox.
I have a list of 15 radio buttons. After displaying them like this:
<div class="abcd" style="margin-left:10px;">
<form id='some'....>
<legend>Select Item type :</legend>
<fieldset style="display:block;float:left;">
<input class="yy" id="sss" type="radio" name="group0" value="aaa"/> ABC
...
</fieldset>
<p>
<input placeholder="Enter Name/Value" name="xxx" id="xxx" size="40" style="display:block;float:left;">
<button type="button" id="xxx" style="width:100;">Process</button>
</p>
</form>
</div>
Everything is displaying in one line. I am not sure how to display the textbox under radio buttons with some space in between.?
pl help.
The problem with your style is the float: left, you have to clear the "floatness".
At the p tag, include the clear:both, it tells the browser that nothing can float at its left or right.
<div class="abcd" style="margin-left:10px;">
<form id='some'>
<fieldset style="display:block;float:left;">
<input class="yy" id="sss" type="radio" name="group0" value="aaa"/> ABC
<input class="yy" id="sss" type="radio" name="group0" value="aaa"/> ABC
<input class="yy" id="sss" type="radio" name="group0" value="aaa"/> ABC
</fieldset>
<p style="clear:both">
<input placeholder="Enter Name/Value" name="xxx" id="xxx" size="40" style="display:block;float:left;">
<button type="button" id="xxx" style="width:100;">Process</button>
</p>
</form>
</div>
paste
<div style="clear:both"></div>
after the fieldset.
When using the float attribute you have to clear it so that other elements won't appear floating next to it. try adding clear: both to the css of the input box like this:
<input placeholder="Enter Name/Value" name="Name" id="NameID" size="40"
style="clear:both; display:block;"/>
Try adding the css rule to the radio buttons themselves. Like this:
<style type="text/css">
.group0
{
display:block;
}
</style>
This assumes group0 is the group with all the radio buttons.