Why is there a form in a Wicket modal window? - wicket

When I look at the HTML of a Wicket modal window, I see a form. Why is it there?

ModalWindow's JavaScript generates a <form> to support the following use-case:
+ Page
+ Form("f")
+ TextField("a")
+ ModalWindow("m")
+ Form("f2")
+ TextField("b")
When rendered in the browser, the nested form "f2" is rendered as a <div> - this is something Wicket does for you because nested forms are not valid HTML.
When opened, ModalWindow removes its containing markup and puts it into a <div> added to the document body:
<form wicket:id="f">
<input wicket:id="a" />
<div wicket:id="m">
<!-- markup removed -->
</div>
</form>
<div>
<form> <!-- generated form -->
<div wicket:id="f2">
<input wicket:id="b" />
</div>
</form>
</div>
Without the generated form the inputs inside the modal window could not be submitted via Ajax.
Note that this has a naughty implication:
Even when you just want to use a form inside the modal window, you still have to have a form wrapping the modal window.
Without it:
+ Page
# wrong - no wrapping form
+ ModalWindow("m")
+ Form("f2")
+ TextField("b")
... "f2" would stay a <form> and the result would invalid HTML with two nested forms:
<div wicket:id="m">
<!-- markup removed -->
</div>
<div>
<form> <!-- generated form -->
<form wicket:id="f2">
<input wicket:id="b" />
</form>
</form>
</div>

Related

Posting from form on Razor Page returns blank page

If I create a form using form tag helper the submit button triggers the OnPost event
<form method="post" asp-page="login">
However if I use
<form method="post" action="/auth/login">
The OnPost event is not fired.
And yes, asp-page="login" translates tp "/auth/login".
Even if I use asp-page="login" and copy the url from the console inspector and paste onto my cshtml page, a blank page is returned.
Any thoughts?
You can try to add #Html.AntiForgeryToken() into the second form.When you use the second form,it will lose a hidden input which contains the antiforgery token.
<form method="post" action="/auth/login">
#Html.AntiForgeryToken()
<input type="submit" value="submit" />
</form>

invalid location of tag a, jsp page in eclipse

I got 'invalid location of tag (a)' message, when I am working on my JSP page.
<a href="abc.html">abc</abc> this tag is not working properly.
<form class="form-inline my-2 my-lg-0">
<c:choose>
<c:when test="${sessionScope.SIGNIN_ID == null}">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">
signin
</button>
</c:when>
...(I erased unnecessary part)
</form>
</nav>
</header>
a tag is located under body > header> nav > form > button > a.
I tried to add <div> after <form> and add <tr>``<td> before <form> but it still doesn't work.
I also have jstl file in my \lib. Is there anyone who can help?
You can't have an a tag inside a button tag, in HTML. What are you trying to achieve, with the href (signinForm.html) inside the button?

Forms within Bootstrap tabs not working/submitting

I'm faced with a simple problem but just don't know how to solve it. I'm using twitter bootstrap's tabs. The tabs work but the forms within each tab don't submit. The forms submit when used without the tabs.
Below is the links I've used for the tabs
<ul class="nav nav-list affix tabs" data-tabs="tabs">
<li>
Overview
</li>
<li>
Profile
</li>
</ul>
And what follows are the tabs
<div class="tab-content span9">
<div id="overview" class="tab-pane" data-toggle="tab">
<!-- Overview Forms go here -->
</div>
</div>
<div class="tab-content span9">
<div id="profile" class="tab-pane" data-toggle="tab">
<!-- Profile Form go here -->
</div>
</div>
Finally I've added the following jquery
$('.tabs').tab();
$('.tabs a[href="#profile"]').tab('show');
Same goes for bootstrap panels, when you have a form inside panel-body and try to submit the form nothing happens. You have to remove the "panel-collapse" class from the body :)

How HTML Form Tag Effect on search result

I wonder if form tag wrapping div contents will effect on search engines result (like Google,bing,yahoo)
<form onsubmit="return oQuickModify.bInEditMode ">
<div class="post">
<div id="msg_4" class="inner">
Post contents here ....
............
............
</div>
</div>
</form>
^^ this is SMF board post viewing format
It will have no effect whatsoever.

How do I click on a button in Selenium IDE using only the text associated with the button and not its position?

this is the dom source of the button I want to click on
<div class="footer clearFloat">
<div class="left">
</div>
<div class="right">
[P]
[-575063738]
[SB_XML]
<input class="button" value="Next step" id="dpTransportResultSelectLink[7]" type="submit">
</div>
</div>"
This is the x-path "/html/body[#id='transport-results']/div[#id='master']/div[#id='master_center']/div[#id='page_content']/div[#id='contentPad']/form[#id='fare_5']/div[2]/div[2]"
How do I frame my locator using "[SB_XML]", irrespective of the form Id?
//*[contains(text(),'[SB_XML]')]/following-sibling::input[1]
I've tested it as an xpath but not in Selenium
lemme know how it goes