"Submit" JSP in iFrame - html

I have a dropdown list, where a user's selection determines the inputs to display next.
For example, selecting birds will open a page where a user is asked to enter wingspan, beak type, feather type, or whatever.
Selecting fish will create a completely different page. This is all created dynamically through jsp, getting data from a textfile through Java. (please ignore bad coding)
How do I make this second jsp load in an iFrame on the same page, instead of redirecting to a new page?
I'd (ideally) like to be able to select different options from the dropdown, and see the input form change with each click of the submit button.
The user selects from the dropdown list, and clicks submit, which calls the jsp method / page.

Do this
<form action="demo_form.asp" method="get" target="frame">
<select name="selection">
<option value="fish">Fish</option>
<option value="bird">Bird</option>
</select>
<input type="submit" value="Submit">
</form>
<iframe name="frame"></iframe>
In the target give the name of the iframe as target,and the action will get executed in the iframe

Related

runat="server" and multiple forms on a vb.net page

I have a page that displays employee information for a company. The list is split into 3 groups. Each group has an add button and an edit button. The buttons call the respective subform in a modal window.
Since the forms are built in vb.net and use ASP objects, they need the form to be wrapped in a form that has runat="server". I am unable to add the run at server directive to each of the 6 sub forms's form tags as I can only have one runat="server" per page.
To get around that, I added the directive to a form element that wraps the body of the page. Now I'm getting an error because of nested form elements. How do I get around this?
<body>
<form runat="server">
<form id="popup1">
</form>
<form id="popup2">
</form>
<form id="popup3">
</form>
<form id="popup4">
</form>
<form id="popup5">
</form>
<form id="popup6">
</form>
</form>
</body>
I read about the form elements getting a form attribute that ties the elements to a particular form as in form="form1" and so on. But I'm not sure if that will work in my case since some folks may try to use Internet Explorer which does not support the form attribute.
I'm thinking that I need to create only one modal form for my page, add all the elements for all six forms and then use logic to show/hide elements based upon which button is pressed. The problem is that the forms are rendered on the server side using asp elements and the button press is client side. I could use some javascript to handle this, but things could get messy. Additionally, the forms may get loaded with data or not depending on whether the button presses is add employee or edit employee.
Maybe I should create the 6 modal forms without using asp objects and stick to HTML objects. This negates the use of ASP's regular expression validators but I'm ok with that.

How to stop drop-down submit form appending url?

I have constructed a drop-down menu that once an item from the list is selected and the submit button clicked, it will send the end user to an external url. However, the form is appending the url which causes issues with a particular external website from recognising the url and returns an error (this is something the website has suggested would happen to stop tracking appending).
Example:
Normal url - https://google.com - is changed to - https://www.google.com/?=http%3A%2F%2Fgoogle.com&gws_rd=ssl
Furthermore, it depends which browser you use. Safari, Fierfox and Chrome are fine. However, IE or Edge cause the error on the website.
Is there anything I can change in the code below to prevent the url from being appended????
<form method="get" action="http://example.com/">
<select name="" onchange= "this.form.action=this.value">
<option value="0">Please Select</option>
<option value="http://google.com">Google</option>
<option value="http://yahoo.com">Yahoo</option>
</select>
<input type="submit" value="Submit" />
</form>
You are using the GET method
<form method="get" action="http://example.com/">
It append value at the end of your URL to send them to your form handler
If you don't want those value to be seen you should use POST method
<form method="post" action="http://example.com/">
Have a look over there https://www.w3schools.com/tags/ref_httpmethods.asp and there https://www.w3schools.com/tags/att_form_method.asp

Does googlebot interact with the <select> or <input type="submit"> inside <form method="post">?

Background of Problem:
I have a search page that allows users to select their search criteria using a <select>. Once the user has selected their desired criterias, the user can then click the search button which will navigate to a new page and return results based on their selected criteria. The submit button is a <input type="submit"> inside <form method="post">.
The problem is I do not want google touching any of the <select> or <input type="submit"> inside <form method="post"> as both elements have ajax get/post attached to them. Furthermore, I also do not want google to index the result pages of the search.
I have specified in robots.txt to block web-crawlers from navigating to the results page but I want to ensure that they are not playing around with any of the menus or submit buttons. After doing some reading, apparently googlebot is capable of selecting options from select menus as well as submitting forms.
Here is a link of where I read this from:
http://googlewebmastercentral.blogspot.ca/2008/04/crawling-through-html-forms.html
http://googlewebmastercentral.blogspot.ca/2011/11/get-post-and-safely-surfacing-more-of.html
Question:
Does googlebot interact with the <select> or <input type="submit"> inside <form method="post">
If yes, is there any way to prevent googlebot from touching any of the <select> or <input type="submit"> inside <form method="post">

Is it possible to have html form submit multiple times?

I have a form that takes input from a dropdown list now and onsubmit opens a new tab getting the value from the selector.
Pseudoexample:
<form xmlns="http://www.w3.org/1999/xhtml" action="http://google." method="get" target="_blank">
<select>
<option value="com">com</option>
<option value="co.uk">co.uk</option>
</select>
<input type="submit" value="Go" />
</form>
My question is whether it would be possible to change the select to checkboxes and open n windows for n checkboxes checked. e.g. in this example if both com and co.uk are selected, 2 windows will open instead of google.com.co.uk
I know I can do it in javascript (and I have already) avoiding forms entirely. This is not an option however, as this is to be hosted on google sites, which don't allow window.open()

Opening a popup window based on selected dropdown option

What I'm trying to do is create a simple form with a dropdown list and a submit button. Upon selecting an option from the dropdown list, the user clicks the submit button and a popup window opens that allows them to view more info about the option they selected.
Right now I simply have:
<form action="example.php" method="post" target="_blank">
<select size="7" name="identifier" style="width: 100%;">
<option>
Options....
</option>
</select>
</form>
Now this does 'work' as is in that when the user selects an option and presses submit, it opens a new window with the selected option post data passed along. However I would like it specifically to open a smaller popup window with a size I can define rather than a whole new window. I'm also aware target=_blank is deprecated so I'm wondering what would be the preferred way to achieve this now?
Here is the link that may be solve your problem (stackoverflow Link) : how to show popup if select "option" in "select" dropdown using javascript?
Try this
<form action="example.php" method="post" target='popup' onsubmit="window.open('','popup','width=700,height=400,left=200,top=200,scrollbars=1')">
Or add this code to your submit button :
onclick="window.open('','popup','width=700,height=400,left=200,top=200,scrollbars=1')"
onsubmit call a javascript function.
in that function get all the values you need to pass
e.g. var myelementval = document.getElementById('myelement')
then use
window.open('mywindow.php?myelement='+myelementval,"mypopupname","width=500,height=400,resizable=yes,top=100,left=200,scrollbars=yes"
.........