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

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>

Related

Request.Form is nothing when the object is disabled

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" />

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...)

Jquery sliders do not work in aspx page but works fine in HTML

Scenario:
Within an asp.net site, we have 3 jquery sliders on ASPX page.
The three sliders (can be seen in the below jsfiddle link) are
a) Price
b) Variant
c) Related items (it is within the tab)
The JSfiddle link is below.
http://jsfiddle.net/DfKwy/5/
The 3rd slider (related-items sliders) is creating problem such as the previous & next arrow buttons do not slide and also when this slider is present, the other sliders do not slide (user doesn't get to see previous / next buttons).
I just took html/script/css from the aspx page and put them in jsfiddle & everything seems to be working. However on the live asp.net it doesn't work. I have made the asp.net as public facing and I can share the url also.
The aspx page uses updatePanel, ajax. Even in my jsfiddle example I have commented some script blocks.
Please help in debugging this further.
PS: For some reason, I can't submit this question without posting code. Please check the above jsfiddle link for complete code. The below code is just couple of lines only and is not complete.
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
</div>
Maybe there are other scripts/line of codes affecting your desired outcome? Maybe your'e referencing conflicting jquery versions such?
Please see link.
conflict between jquery-1.2.6.min.js and jquery-1.4.2

FORM POST not passing input values

I have a simple form that passes to an ASPX page to watch a video. The ASPX page uses a hidden field from the form to load the correct video.
This works for me, but a couple other people are the error message because it appears the value isn't being passed. I'm assuming it's a setting in IE... Anyone seen this or know how to fix? OR a better idea?
Simple form on "yourdomain.org"
<form action="http://www.mydomain.org/WatchVideo/Default.aspx" method="post" enctype="multipart/form-data">
<input type="hidden" name="hidden" value="movie.flv" />
<input type="submit" name="submit" value="Watch Video" />
</form>
The ASPX page on "mydomain.org"
If Request.Form("hidden") IsNot Nothing Then
lit.Text = Request.Form("hidden")
Else
Response.Write("Not Authorized. Video Not Passed.")
End If
Sounds and loooks pretty straight forward. Not sure why the same version of IE would have different results. Any other thoughts on how to do this? I need to keep the "off site" coding simple and in HTML for non-technical folks.
Thanks.
It appears to be a setting inside of the browser. I couldn't narrow it down to a specific setting, but once we changed the "Internet" zone to medium from medium-high it began working. It has something to do with posting form data across domains.

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.

Resources