scala type of forms - scala

i'm new to scala language . what i wanted to know is i need to select a value from a drop down.what happens here is drop down as below.
<input id="categoryDid" class=" x-form-text x-form-field print_underline x-form-empty-field x-trigger-noedit" type="text" name="category" autocomplete="off" size="24" tabindex="1" readonly="" style="width: 132px;"> drop down data some where else. <div id="ext-gen274" class="x-combo-list-inner" style="width: 148px; margin-bottom: 8px; height: 63px;">
drop down data some where else as below.
<div id="ext-gen274" class="x-combo-list-inner" style="width: 148px; margin-bottom: 8px; height: 63px;">
<div class="x-combo-list-item">--Select--</div>
<div class="x-combo-list-item">Mobile Phone</div>
<div class="x-combo-list-item x-combo-selected">Tablet</div>
</div>
i'm using gatling / scala combination .now what i need to select is "Mobile Phone". i used formParam("categoryDid", "Mobile Phone") but seems this is not working.
can some one help ?

The NAME of your parameter (see input field) is category, not categoryDid:
formParam("category", "Mobile Phone")

Related

Why are my dots removed when i post a form?

When I post my form, the points in my double are removed.
Does anyone have any idea what this is?
My model field:
[Display(Name = "Domeinnaam prijs:")]
public double DomainNamePrice { get; set; }
My HTML to fill the field in a form:
<div class="row">
<label class="col-lg-3" style="margin:auto; font-size: 120%;" asp-for="DomainNameLine"></label>
<div class="col-lg-9">
#Html.CheckBoxFor(i => i.DomainNameLine, new {#id = "DomainNameCheckbox", #name = "DomainNameLine", #onclick = "DomainNameCheck()"})
<span asp-validation-for="DomainNameLine" class="text-danger"></span>
</div>
</div>
<div id="DomainNameField" style="display:none;">
<div class="row">
<label class="col-lg-3" style="margin: auto; font-size: 120%;" asp-for="DomainNamePrice"></label>
<div class="col-lg-9">
<input asp-for="DomainNamePrice" class="form-control" />
<span class="text-danger" asp-validation-for="DomainNamePrice"></span>
</div>
</div>
</div>
For example, when I enter 14.99. I get 1499 as a result.
The form field
The result
Can someone help me?
Set this in your web.config
<system.web>
<globalization uiCulture="en" culture="en-US" />
You appear to be using a server that is setup with a language that uses comma's instead of decimal places. You can adjust the culture to one that uses the comma's in a way that your application is designed, such as en-US.
or you can add this statement on the page:
<%# Page uiCulture="en-US" culture="en-US" %>
Hope this helps.

Is it possible to have two selected classes with different designs on the same page/component?

Svelte has a great tool for define design of classes but is it possible to define two different classes in one component?
I am working on the menu, which is in one component. When the page is reloaded I need to have 'selected' two buttons, one from the main menu and the second from a submenu, but it seems that even if the classes have different names and variables it activates only one of them - the first one. Is it possible to select more classes/active-buttons in one component at the same time?
You can use several class: directives in the same component, on different elements as well as multiple times on a single element.
On a single element, you're allowed to mix & match multiple class: directives with the class= attribute. Svelte will merge the result.
All of this is supported, as demonstrated by the following code (and REPL):
<script>
let name = 'world';
let red = false
let underline = false
let align = "left"
</script>
<p>
<label class:selected={red}>
<input type="checkbox" bind:checked={red} />
Red
</label>
</p>
<p>
<label class:selected={underline}>
<input type="checkbox" bind:checked={underline} />
Underline
</label>
</p>
<p>
Align
<label class:selected={align === "left"}>
<input type="radio" value="left" bind:group={align} />
left
</label>
<label class:selected={align === "center"}>
<input type="radio" value="center" bind:group={align} />
center
</label>
<label class:selected={align === "right"}>
<input type="radio" value="right" bind:group={align} />
right
</label>
</p>
<h1
class="align-{align}"
class:red
class:underline
>
Hello {name}!
</h1>
<style>
.red {
color: red;
}
.underline {
text-decoration: underline;
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
label {
padding: .5em .5em .25em;
}
label.selected {
background: lavender;
}
</style>
Single element with multiple class directives and mixed with class attribute:
<h1
class="align-{align}"
class:red
class:underline
>
Hello {name}!
</h1>
A same class (selected) used on multiple elements:
<p>
<label class:selected={red}>
<input type="checkbox" bind:checked={red} />
Red
</label>
</p>
<p>
<label class:selected={underline}>
<input type="checkbox" bind:checked={underline} />
Underline
</label>
</p>
There must be something else going on in your case (or I didn't understand your question).

Not able to locate an element by its string name

I am using protractor 5.2.2. I have to locate a dropdown element by using its sting name.So i have tried with below code,but its not working.
element(by.xpath("//content[contains(string(), 'Learn more')]")).click();
or
element(by.xpath("//div[contains(string(), 'Learn more')]")).click();
The UI code is given below
<div jsname="YCbqLe">
<div jsaction="aLn7Wb:kbDuhe">
<div role="listbox" aria-expanded="false" class="Ej ljmwzf" jscontroller="YwHGTd" jsaction="click:cOuCgd(LgbsSe); keydown:I481le; keypress:Kr2w4b; mousedown:UX7yZ(LgbsSe),npT2md(preventDefault=true); mouseup:lbsD7e(LgbsSe); mouseleave:JywGue; touchstart:p6p2H(LgbsSe); touchmove:FwuNnf; touchend:yfqBxc(LgbsSe|preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd(LgbsSe); focus:AHmuwe; blur:O22p3e;b5SvAb:TvD9Pc;" jsshadow="" jsname="HvyTdb" aria-label="Add a button (optional)">
<div jsname="LgbsSe" role="presentation">
<div class="EI" jsname="d9BH4c" role="presentation">
<div class="Di LMgvRb y3" jsname="wQNmvb" jsaction="" data-value="" aria-selected="false" tabindex="-1" role="option">
<div class="Di LMgvRb" jsname="wQNmvb" jsaction="" data-value="BOOK" aria-selected="false" tabindex="-1" role="option">
<div class="Di LMgvRb" jsname="wQNmvb" jsaction="" data-value="ORDER" aria-selected="false" tabindex="-1" role="option">
<div class="Di LMgvRb" jsname="wQNmvb" jsaction="" data-value="SHOP" aria-selected="false" tabindex="-1" role="option">
<div class="Di LMgvRb bf" jsname="wQNmvb" jsaction="" data-value="LEARN_MORE" aria-selected="true" tabindex="0" role="option">
<div class="qm he" jsname="ksKsZd"></div>
<content class="u5 jh">
"Learn more"
</content>
</div>
<div class="Di LMgvRb" jsname="wQNmvb" jsaction="" data-value="SIGN_UP" aria-selected="false" tabindex="-1" role="option">
<div class="Di LMgvRb" jsname="wQNmvb" jsaction="" data-value="GET_OFFER" aria-selected="false" tabindex="-1" role="option">
</div>
</div>
How can i select the the drop down text "Learn more" here, using the text 'Learn more'.Thanks in advance
you can also use the css locator as below
element(by.cssContainingText("content", "Learn more"))
or with Xpath
element(by.xpath("//*[text()='Learn more']")
Looks like the text have some space. You can copy the complete text between tags and use that in that above xpath or can try the below example
//content[normalize-space(text())='Learn more']
or you can try this css
element(by.css("div[data-value="LEARN_MORE"] content")
Try this xpath to locate the element. If click is not working out, probably this element does not have click action.
//content[contains(text(), '"Learn more"')]
You may try invoking the click action for either one of the below.
//div[#data-value="LEARN_MORE"]
or
//div[#data-value="LEARN_MORE"]/div

How do I make a HTML form using <label> <input> and <span>?

I have made a form in HTML using a table and that worked fine, however, my teacher told me that making forms from tables is not the proper way to do it anymore, instead I should use:
<form>
<label></label>
<input>
</form>
but he also mentioned something about using <span></span> and I'll guess it is just about this point where I got a bit confused, because where should I use it - ie. should I put the <label> and the <input> in between <span></span> ?
A few of the reason I ask is:
I don't consider myself very savvy when it comes to HTML
I would just have used a <div></div> to wrap around the <label> and the <input> and then use css to put it where I want it to appear on the webpage.
Regarding the form I want to create then I want it to look like this:
[Firstname] [lastname]
[textfield] [textfield]
[Street] [zip-code] [city]
[textfield] [textfield] [textfield]
[E-mail] [Phone]
[textfield] [textfield]
[message]
[textarea]
I hope the layout of my form makes sense to the majority of you !
Try something like this:
<form action="action.php">
<label for="firstName">First Name</label>
<input type="text" name="fname" id="firstName"><br>
<label for="lastName">First Name</label>
<input type="text" name="lname" id="lastName"><br>
....
</form>
and to line it all up you could use some css like this:
label{
width: 100px;
text-align:left;
}
Although you could use SPAN technically.. as it's an inline element and so are LABEL and INPUT, it doesn't quite sit well. Inline elements aren't really designed to be containers, so using a block level element such as a DIV would be a better way of structuring it.
Beyond this to make it line up, you're moving into the relms of CSS to float your elements.
So something alone the lines of:
<form action="">
<fieldset>
<div class="left">
<label for="FirstName">First Name</label>
<input type="text" name="FirstName" id="FirstName">
</div>
<div class="right">
<label for="LastName">Last Name</label>
<input type="text" name="LastName" id="LastName">
</div>
</fieldset>
</form>
<style type="text/css">
fieldset {
width:500px;
overflow:hidden;
}
fieldset .left {
float:left;
width:50%;
}
fieldset .right {
float:right;
width:50%;
}
fieldset label {
display:block;
}
fieldset block {
display:block;
}
</style>
You teacher probably means that you should wrap each pair of input and label in a span. You are quite right in thinking that you should use div instead of span there. Just tell your teacher to look at the page when style sheets are disabled. On similar grounds, you should prove her/him that he is all wrong about saying that a table should not be used.
To do the exercise of writing a form (that is essentially tabular data) without using table markup, just use your div approach and use tabular layout features of CSS: set display: table on the form, display: table-row on the div elements, and display: table-cell on the input and label elements. Add padding and horizontal alignment as needed. Do not forget to inform your teacher that this will only work on sufficiently modern browsers, whereas the logical approach of using an HTML table works on all browsers.

knockout doesn't update html after get data from ajax

I bind list of data to HTML, in each list has button for get details by ajax. I want to bind callback data to member of model, After ajax call back, object have data, view received ( ko.toJSON(d, null, 2))object. But HTML doesn't update data.
I don't know what is wrong. please help. Thank you.
Html:
<section id="lists">
<article class="todoList">
<script type="text/html" id="person-template">
<!-- <p>Credits: <span data-bind="text: message"></span></p>-->
<p>xxx</p>
</script>
<ul data-bind="foreach: Items">
<li>
<div>
<span class="contentarea" data-bind="text: message"></span>
<button data-bind="click: $parent.evClick.bind($data)">Get details</button>
<button data-bind="click: detail">Ajax-Get</button>
<p>Credits: <span data-bind="text: d.message"></span></p>
<div style="display: block; width: 200px; height: 200px; border: solid 1px #ff6a00;" data-bind="text: ko.toJSON(d, null, 2)"></div>
</div>
</li>
</ul>
</article>
</section>
Full code here.
http://jsfiddle.net/wuttipat/sc8fX/12/
You should use
<div data-bind="with: d">
<span data-bind="text: message"></span>
Because data-bind="with: d" create scope for binding context when you use data-bind="text: message" inside it will reference to parent binding context in this case mean d.
Full code here : http://jsfiddle.net/sc8fX/74/
I think I've figured it out (after cleaning up the fiddle some more). You're binding is
text: d.message
But it should be
text: message
Because d is the context of your binding. So you're actually trying to bind to d.d.message which doesn't exist. Replacing it with text: message seemed to work, no?
See this updated fiddle.
I found the issue posted on knockout document.
http://knockoutjs.com/documentation/with-binding.html