Request.Form is nothing when the object is disabled - asp.net

I Google and search every article here and in the google but i cannot find anything regarding this issue. Any idea why the request.form["name here"] is nothing when the html control is disabled something like
<input type="radio" name="name here" disabled />
removing disabled would return the values. I tested this only on IE 10 not sure on other browsers.
I am looking into changing the css of the radio button but that is a different story.
Thank you.

Disabled form fields are not part of the posted data. If you disable the html control the data will not be posted.
If you want to show the data and have it posted, but not possible to edit you can set the control to readonly instead.
<input type="radio" name="name here" readonly="readonly" />

Related

Using React-hook-form and I can't change the value of posts whether it is published or not

Now, I am working on the project creating a blog like site and I am facing the problem that I can't change the value whether it is published by using checkbox and react-hook-form.
It workded a weeks ago so I am thinking this is due to the update of react-hook-form but I don't know how to solve it.
I am assuming that the code below is the part to be changed.
publish is a checkbox and when checked and submitted the value of post changed to published and turned to be visible. but corrently I can't turn it to be published. It stays false which means it is not published even if it's checked.
<fieldset>
<input className={styles.checkbox} name="published" type="checkbox" ref={register} />
<label>Published</label>
</fieldset>
<button type="submit" className="btn-green" disabled={!isDirty || !isValid}>
Save Changes
</button>
this part works fine.
{!isDirty || !isValid}
I hope some kind people will help me.
Thank you.
The problem here is similar to your last question - you need to modify the usage of register to support v7:
<fieldset>
<input type="checkbox" {...register("published")} />
<label>Published</label>
</fieldset>

checkbox not clicked by webdriver

I have a check box next to the text "I have read and agree to the Terms and Conditions" in a registration page. During playback, i can see
some clicking is happening . But at the end the check box is still unchecked. why is it so.
This is my HTML code
<div class="checkbox_container">
<input name="newuserXYX.agree" value="true" tabindex="106" id="newuserXYX.agree" onclick="ABC.e.reg.checkuserNameAvailability();" type="checkbox">
<input id="__checkbox_newuserXYX.agree" name="__checkbox_newuserXYX.agree" value="true" type="hidden">
<label id="registration_Agree" for="newuserXYX.agree">I have read and agree to the Terms and Conditions</label>
</div>
i wrote my testNg code as
boolean checked=driver.findElement(By.xpath("//input[#name='newuserXYX.agree']")).isSelected();
if(checked==false)
driver.findElement(By.xpath("//input[#name='newuserXYX.agree']")).click();
various approaches i tried are
#FindBy(how=How.ID_OR_NAME,using="newuserXYX.agree")
#CacheLookup
private WebElement iagreeCB;
and inside #Test
iagreeCB.click();
for all these i am getting similar result.
why i am unable to click the checkbox ?.
Your Code looks ok to me. Have you checked that the onclick-handler does not interfere with your click? Maybe the username availability check fails (BTW the T&C checkbox is a strange place to check username availability...)

copy and pasting into web input box causes strange behavior?

i have a plain html form on a windows box running windows server 2003. I have come upon something very strange. I input items into an input box and click submit. It safely post to the next page. However if i copy and paste into the box its hit or miss. More miss then hit. WHat i mean is that the input box eventhough has values in it does not seem to post the values to the next aspx page. This is racking my brain.
<form name="sending" method="POST" action="https://xx/Retrieveimg.aspx" target="_self">
<font size="2">invoice :</font><br>
<input name="img" size="50" runat="server">
<input type="submit" value="Send" name="Send">
</form>
has anyone ever seen this behavior before?
I dont see you have an ID for the input which has a runat="server" attribute. Add an ID and try again.

Any work around for this issue -- when going back and forth between pages in Firefox the focus is lost at different points

I have a page that is rendered through xulrunner service. There is a form and a button under the form.
For accessibility requirement, I forced the focus on the text field within the form when the user navigates to this page. However, sometimes JAWS always reads the Post Comment button label. Sometimes, JAWS reads the aria-label “Enter Comments”.
Here is the code:
<body onLoad="document.addcommentform.comment.focus()">
<input type="textarea" aria-label="Enter Comments" title="{$enterComment}" name="comment" />
<input class="Button" type="submit" value="{$postComment}" />
I also tried to put a visible label on the UI like this. I did more testing and found out the behavior is pretty the same.
<label for="addcommentform">Please enter comment
<form method="get" action="{$self}" name="addcommentform">
<textarea title="{$enterComment}" name="comment" class="commentarea" </textarea>
<input class="Button" type="submit" value="{$postComment}" />
</form>
</label>
I think it is related to this known bug https://bugzilla.mozilla.org/show_bug.cgi?id=133771
But does anybody known any workaround to this issue?
I'm a Jaws user and don't know of a way around this. Since Jaws tends to create it's own model of pages in a virtual buffer things can behave slightly differently then you would expect. To confirm or disprove weather it's a Jaws specific bug I would suggest trying out NVDA an open source and quite good Windows screen reader.

IE not offering to save passwords on my login page

I'm developing a basic login page in ASP.NET.
The page includes an email field, a password field and a submit button.
For some reason Internet Explorer doesn't offer to remember the login info, while other browsers such as Firefox & Chrome do.
For other pages (Gmail, Twitter etc.) IE als offers to remember password.
Please note that I am not using a username that I previously asked IE not to remember the password for.
Basically, how does IE recognize a login page, and why won't it recognize mine as such?
Thanks
I had similar problem while developing simple login form which submits itself by tag <a> instead of <input type="submit">. But the form was not developed under ASP.NET (which i do not know what is).
The problem was solved thank to the following article: http://blogs.msdn.com/b/ieinternals/archive/2009/09/11/troubleshooting-stored-login-problems-in-ie.aspx
The article discusses main prolems with occurence of "remember password" dialog in IE. My case was number 5 in that article. I inserted AutoCompleteSaveForm() method before submit() one and IE started to display the dialog.
Breafly speaking, the incorrect form code was:
<form action='javascript:void(0)' method='post' id="form_id" >
<input type="text" id="login_text" /><br/>
<input type="password" id="password" /><br/>
Login
<form/>
The correct one was:
<form action='javascript:void(0)' method='post' id="form_id" >
<input type="text" id="login_text" /><br/>
<input type="password" id="password" /><br/>
Login
<form/>
Hope this helps.
Best Regards,
Ilya.
I know this post is quite old but I was running into this same problem. My issue was that I had converted the Login control to a template and because of styling concerns I changed the default asp:Button to an asp:LinkButton.
Internet Explorer apparently looks for an <input> tag in order to save passwords. The link button renders an <a> tag so IE wasn't recognizing my Login control as a valid login form.
Hope this helps!

Resources