I'm new to Gatling and have to design a performance test. I need to login with several users, who each have different possibilities to choose from. Each possibility has the option to choose it or not and looks somewhat like this in the HTML-Code (simplified)
<input type="radio" name="Name123" value="1" checked="checked" class="uebernehmen">
I need to give the Element under name in formParam in the script. In this case, that is Name123. Like I said, the possibilities are different for each user and each possibility has a different value under name. Is there any way to get that value from the first possibility in the form?
It might be important to say, that if not obvious already, this is just a part of a form and there are various of these, packed in more HTML. One of these elements inside the form would look like this.
<tr>
<tbody class="tagcontent" id="ID"><tr id="ID" class="kurs" >
<td>
<input type="radio" name="Name123" value="1" class="uebernehmen">
</td>
<td>
<input type="radio" name="Name123" value="2" class="abwaehlen">
</td>
</tbody>
</tr>
In addition there is following block at the beginning of the form, where I need to extract the value of PersonID and AccountID, is that possible too?
<input type="hidden" name="PersonID" value="IDP">
<input type="hidden" name="AccountID" value="IDA">
Thanks in advance!
Use a CSS selector check like demoed in the tutorial and in the Gatling Academy.
Related
So I think I'm in some kind of tunnel-vision right now.
I have to maintain a very basic application (HTML + ASP). In this application, there is a small table with some values:
<table>
<tr>
<td>Customer-ID</td>
</tr>
<tr>
<td>Waregroup</td>
</tr>
<tr>
<td>Some other ID</td>
</tr>
<tr>
<td>[edit]</td>
</tr>
<tr>
<td>[delete]</td>
</tr>
<tr>
<td>[checkbox for deletion]</td>
</tr>
</table>
It looks like this, to make it more visual (excluded the rows with data, they are not needed for this):
Now, the delete-function just doesn't take simply the customer-id (KD Nr.), it takes several more arguments, which are provided in a link. For example, this here:
someSite.com?sid=123456&gkid=133&kdid=9043168&wws=9&del=1
Some of the values are taken from the QueryString, other from a ResultSet from a SQL-Query.
Now I had to extend this application and add a checkbox to bulk-deletion. This wasn't a problem at all, but now I'm kinda stuck on how to get the values which are required for the deletion, when I can basically just use 1 value in each checkbox. I thought about using hidden inputs, but then I have no idea how to determine, which "rows" should be deleted and which not:
This is the addtion I made:
<td>
<input type="checkbox" name="deletebox[]" value="0">
<input type="hidden" name="sid" value="<%=Request.QueryString("sid")%>">
<input type="hidden" name="gkid" value="<%=Request.QueryString("gkid")%>">
<input type="hidden" name="kdid" value="<%=rs("ka_kdnr")%>">
<input type="hidden" name="wws" value="<%=rs("ka_sysid")%>">
</td>
My idea is to loop through every checked checkbox, take the values from the hidden fields and run my deletion-script in a loop.
Any lead on how to do so? Can I simply iterate over all checked checkboxes and request for the current value of the hidden fields?
I basically just need the gkid and the gkkid for the stored procedure to work.
If you submit a form which contains multiple instances of the same form variable then that the value of that variable in the Request object will appear as a comma separated array. In other words if your form contains the following:
<input type="checkbox" name="gkid" value="25">
<input type="checkbox" name="gkid" value="50">
<input type="checkbox" name="gkid" value="75">
Then Request("gkid") will display a value of "25,50,75" if you check all of them. You can then split your array as follows.
For i = 1 to Request("gkid").Count
Response.write Request("gkid")(i) & "<br>" & vbcrlf
Next
I'm going to assume that you can take it from there and adapt the above to use Request.Form("gkid")(i) and apply logic inside the loop with code which calls your stored procedure.
Your question mentions a variable called "gkkid". I can't see where that comes from. If I could I might be able to improve on this answer.
I am developing a django/html application where I have a table of data. I have to make a way for my users to delete multiple rows in a table. Therefore, I have decided to add checkboxes in a list.
I know that I can include it as
<tr>
<td><input type="radio" name="item1" /></td>
<td>Item1</td>
</tr>
<tr>
<td><input type="radio" name="item2" /></td>
<td>Item2</td>
</tr>
for each item. Then in the end, I can add:
<input type="submit" name="delete" value="Delete Items" />
But this will mean that I will have to enclose my list within a <form></form>
Is this an ethical way of doing it?
I want to add this feature to my site but I also want to do it in the most professional way. Can anyone tell me if I am going in the right direction?
Since you use Django, one way would be to take advantage of what Django provides for forms.
Here are the examples from the official doc, for version 1.10:
-for the radio buttons:
https://docs.djangoproject.com/en/1.10/ref/forms/widgets/#widgets-inheriting-from-the-select-widget
-for the form:
https://docs.djangoproject.com/en/1.10/topics/forms/#building-a-form-in-django
A django form uses the form tag.
Basically, I have a table with inputs inside a form tag, that are required by user to fill in.
When I test it, the form is working, but only when there is one row in a table. With two an more rows, a required attribute is not working.
I've written a simple example
This works, click enter inside input field to see.
<form>
<table>
<tr>
<td>
<input type="text" name="usrname" required>
</td>
</tr>
</table>
</form>
<br>
This doesn't work, click enter inside input field to see.
<form>
<table>
<tr>
<td>
<input type="text" name="usrname" required>
</td>
</tr>
<tr>
<td>
<input type="text" name="surname" required>
</td>
</tr>
</table>
</form>
That's because forms with more than one text input aren't submitted by hitting enter. Try adding a submit button to both forms and you'll see it works fine.
In your example, is that supposed to be two identical fields in the different cells (and one of them is just misspelled)? If so, that's likely your problem. If they are intended to be two separate fields, it should work, but I'd need to see a more real-world example.
Also, I'd highly recommend using CSS to format/style your form. If that sounds intimidating, try Bootstrap--it makes creating pretty forms extremely easy.
[Solution: Change my names to arrays by concatenating "[]" to the end. Also, change my IDs to be unique values to conform to HTML specifications]
I'm creating a form, that has a matrix (html table) of checkboxes with one user per row, and user permissions on the columns. Each cell has a checkbox. Each checkbox in a row has the "name" set to the user's email address (unique). The values of the checkboxes are the IDs of the particular permission. when I click the submit button, and inspect the params I get back from the HTTP POST, only the right-most checkbox is set for rows that have multiple boxes checked.
For example, there are three checkboxes, first and second checked, third unchecked. I only get back the name=id of that second checkbox.
I'm building the form in Rails, although I don't believe that to be relevant really. Also, the browser that's giving this behavior is Chrome, Iceweasel, and Epiphany... So I think it's my form.
An excerpt of my form:
<tr>
<td>UserOne</td>
<td>one#oreo.com</td>
<td>
<input checked="checked" id="one_oreo.com" name="one#oreo.com" type="checkbox" value="1" />
</td>
<td>
<input id="one_oreo.com" name="one#oreo.com" type="checkbox" value="2" />
</td>
<td>
<input id="one_oreo.com" name="one#oreo.com" type="checkbox" value="3" />
</td>
<td>
<input checked="checked" id="one_oreo.com" name="one#oreo.com" type="checkbox" value="4" />
</td>
<td>
<input id="one_oreo.com" name="one#oreo.com" type="checkbox" value="5" />
</td>
<td>
<input id="one_oreo.com" name="one#oreo.com" type="checkbox" value="6" />
</td>
</tr>
You have set the name="" on all of them to the same thing, so it is going to replace whatever value was originally there when you tick more than one checkbox.
Either give each checkbox a different name e.g. name="one#oreo.com_check_1" or turn them in to an array using name="one#oreo.com[]" This will then store all values passed to it in an array that you can then process after the form has been submitted!
The names of your checkboxes need to be unique. I suggest puttitempeh user id and permission id in the name. Also you should change the Ida accordingly. The ids don't affect form submission but it is incorrect to have multiple elements with the same id in HTML.
You can't name the name param to the same value for each row. Checkboxes need to be unique or at least an array. Radio buttons are where you would use the same name value.
Is there a correct way to include multiple forms in a single table?
For example, I have 8 rows, four of them correspond to a single table, the other four correspond to a second. What would be the best way to do this? I know putting a table between TRs is invalid.
I think I found the solution for your problem, since I found myself on the same situation. Here is an example of what I did.
<form id="uno" name="uno" action="somescript.php" method="post">
<input type="hidden" id="myhidden" value="1">
</form>
<form id="dos" name="dos" action="anotherscript.php" method="post">
<input type="hidden" id="myhidden" value="2">
</form>
<table id="uniqueTable">
<tr>
<td><input form="uno" type="text" id="x_value" name="x_value" value="0.00"></td>
<td><input form="dos" type="text" id="x_anothervalue" name="x_anothervalue" value="0.00"></td>
</tr>
</table>
In this way, although there is only one table each of your inputs will belong to the form stated with the form="formName"
Hope it helps someone
- anakin
I don't think there is a standard way to do this. (which sucks)
You'll have to do something like give all the form elements in a row a prefix to indicate which row they are in, then detect which button was pressed. On the server you can then discard all the values that you aren't interested in.
edit: The information (name and value) of the buttons not pressed won't be submitted)
(Alternatively, if you use javascript you should be able to make work around to collect all the values from that row's inputs when the button is pressed.)