I trying to enter value to text area using vbscript but i am not able fill. text are tag dont have id it have only name - vbscript

HTML code :
<textarea name="q", class="classname" placeholder="enter the search content"><\textarea>
and it is inside table and table is inside form I tried to use document.forms but I didn't get expected output.
I tried with document.getelementbyname("q").placeholder = "value"

Related

Jqgrid colNames set from a jsp hidden variable

I have a jqgrid whose column Name I wish to set from a jsp hidden variable.
<input type="hidden" name="columns" id="columns" value= "<%= finalColumns %>"></input>
This hidden id columns has the values:
value="'Master Code','Mst. Code Description','Master Code Status','Master Code Groups','Detail Code Groups','No. of Detail Codes','Length','Attribute Type','sample'" .
Now I am trying in my Javascript like
colNames:'['+$("#columns").val()+']',
But I am getting an alert box saying Length of colNames <> colModel.
I have checked, there are 9 col models and 9 values are present in the string. Where am I doing some mistake
UPDATE:SOLUTION :
I tried using
eval(('['+$("#columns").val()+']').toString()).
That solved the problem. I have to understand Why this solves the problem
Thanks anyways

ruby mechanize find and fill input tag value

I need to fill the value of an input tag not surrounded by a form tag, I do not need to submit it, just fill in a value.
I have the code below:
input = my_page.at("#crn_id1")
my_page.form_with(:id => 'crn_id1').value = '90098'
input = agent.click(my_page.at('[#value="Submit Changes"]'))
puts input.content
I am getting an error but what I am trying to do is fill out the input tag which has html of:
<TD style=padding:10px; CLASS="dedefault"><p class="centeraligntext"></p>
<LABEL for=crn_id1><SPAN class="fieldlabeltextinvisible">CRN</SPAN></LABEL>
<INPUT TYPE="text" NAME="CRN_IN" SIZE="8" MAXLENGTH="5" ID="crn_id1">
</TD>
I just want to fill out the input tag which in NO way is surrounded by a form tag with a value of 09987. I have the correct html page but cant seem to set the value of the input and tag to set it and set it in mechanize.

XPATH required for an input text field?

i have a text box in my web application,Where i need to give input. I am trying to find the xpath of the text box. the following error is thrown.
Unable to locate element: {"method":"xpath","selector":"
HTML code:
<div class="input">
<input id="firstName" class="long" type="text" maxlength="50" value="" name="firstName
I want the xpath for firstName textbox.
//input[#type='text']
And this for generally targeting a text input (what I was after)
Try this one:
//input[#id='firstName']
Explanation:
// search on all levels
input for element nodes with the name of "input"
[#id='firstName'] having an attribute (#) with the name of "id" and a value of "firstName"
at least 3 simple ways to get this:
1)Driver.FindElement(By.XPath("//input[#id='firstName']"));
2)Driver.FindElement(By.Id("firstName"));
3)Driver.FindElement(By.CssSelector("#firstName"));
//*[text()[contains(.,'firstName')]]
finding by text would always work.

Scrapy Xpath query to select input tag elements

I'm using Scrapy crawl spider and trying to parse output pages to select all input tag parameter as the following :
input type: must be (text or password or file)
input id: if it's not found , select [input name] instead.
I wrote a sample code for test in Scrapy shell, but it doesn't give me the exact result.
Tested site: http://testaspnet.vulnweb.com/Signup.aspx
>>> hxs.select('//input[#id] | //input[#type="text"] | /text()').extract()
[u'<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTY0MzI4NjU4Mw9kFgICAQ9kFgICAQ9kFgQCAQ8WBB4EaHJlZgUKbG9naW4uYXNweB4JaW5uZXJodG1sBQVsb2dpbmQCAw8WBB8AZB4HVmlzaWJsZWhkZHEZ3VN6SP/C2xESDN/Y3p8zhfSB">',
u'<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWWgKJ+8rsBQLStq24BwK3jsrkBALF97vxAQKozoCcCQKpzpj7DgKSnr/eCQKSnr/eCQKSntPyAgKSntPyAgKSnseJCgKSnseJCgKSnvusAwKSnvusAwKSnu/DDAKSnu/DDAKSnoPmBQKSnoPmBQKSnre9DQKSnre9DQKSnqvQBgKSnqvQBgKSnp+5AwKSnp+5AwKSnrPcDAKSnrPcDAL3pJ3FDwL3pJ3FDwL3pLGYBwL3pLGYBwL3pKU/AvekpT8C96TZ0wkC96TZ0wkC96TN9gIC96TN9gIC96ThjQoC96ThjQoC96SVoAMC96SVoAMC96SJxwwC96SJxwwC96T9rAkC96T9rAkC96SRwwIC96SRwwICyMvj6AUCyMvj6AUCyMuXjw0CyMuXjw0CyMuLogYCyMuLogYCyMu/+Q8CyMu/+Q8CyMvTnQcCyMvTnQcCyMvHMALIy8cwAsjL+9cJAsjL+9cJAsjL7+oCAsjL7+oCAsjLw9MPAsjLw9MPAsjL9/YIAsjL9/YIAq3SwZ8KAq3SwZ8KAq3S9bIDAq3S9bIDAq3S6ckMAq3S6ckMAq3SnewFAq3SnewFAq3SsYMNAq3SsYMNAq3SpaYGAq3SpaYGAq3S2foPAq3S2foPAq3SzZEHAq3SzZEHAq3SofkFAq3SofkFAq3S1Z0NAq3S1Z0NAob5pwUChvmnBQKG+dvZCQKG+dvZCaCOP7DYDQ3mNEhISrmdoTKH9Tws">',
u'<input name="tbUsername" type="text" id="tbUsername" class="Login">',
u'<input name="tbPassword" type="password" id="tbPassword" class="Login">',
u'<input type="submit" name="btnSignup" value="Sign me up" id="btnSignup">']
All input elements of type text, password or file:
//input[#type='text' or #type='password' or #type='file']
I am not sure of what condition you want on the id or name - this will get all input elements of those three types that have either an id or name:
//input[(#type='text' or #type='password' or #type='file') and (#id or #name)]
If you want to test for the id or name (if the id does not exists) equal to something (XXXX):
//input[(#type='text' or #type='password' or #type='file') and (#id='XXXX' or (not(#id) and #name='XXXX'))]
If you want to extract the id:
//input[#type='text' or #type='password' or #type='file']/#id
I don't think extracing either the id or the name if the id is not specified is possible with standard XPaths.
I don't know Scrapy, but from a purely XPath point of view, the following should satisfy the requirements you describe:
//input[(#id or #name) and (#type = 'text' or #type = 'password' or #type = 'file')]
Also, I notice you're trying to retrieve the text content of the selected nodes. This will presumably return nothing because inputs are self-closing tags and do not hold inner content.

Validating input type number in html5

I want to restrict entry of input onto a field of type number such that input cannot be outside range of min-max specified in the html.
input type = "number" min = "1" max = "5"
Is there a way of outputting the number field without the text box and i would rather not use
"input type = range"
as slider does not show value currently selected
Please help.
Thanks.
Based on what you said, I suggest using a simple input text field and check it's value validity on submission via JavaScript (as #Kush mentions above). You could also check it as the user types, or moves focus away from that field.
<form>
Only 1 to 100 <input type="text" name="number" pattern="\d{1,2}(?!\d)|100" title="one to hundreed only">
<input type="submit">
</form>

Resources