I'm trying to get my form to open up in a new window when the Search button is clicked, but the target="_blank" function is not working. I'm borrowing code from another institution's form, and I'm wondering if the javascript is forcing each submission to open in the same window (I'm not familiar enough with javascript to know for sure).
The search that I need to open in a new window is from the "Books & More" tab of the following website: http://library.utb.edu/search/search2. This is the code that I'm using for that form:
<form target="_blank" name="searchform" onSubmit="return dosearch();" action="http://lib3.utpa.edu/search~S2/X" method="post" class="unpadded">
<input name="searcharg" value="" type="text" id="SEARCH" class="big-search-text" placeholder="Example: Of Mice and Men">
<input class="big-search-submit" name="cmdSubmit" type="submit" value="Search">
<input name="searchtype" type="radio" checked="" value="http://lib3.utpa.edu/search~S2/Y"> All Fields
<input name="searchtype" type="radio" value="http://lib3.utpa.edu/search~S2/t" target="_blank"> Title
<input name="searchtype" type="radio" value="http://lib3.utpa.edu/search~S2/a"> Author
Advanced Search
</form>
Any suggestions you could give would be greatly appreciated!
You can try putting your formtarget="_blank" in your submit input tag.
Example:
<input formtarget="_blank" class="big-search-submit" name="cmdSubmit" type="submit" value="Search">
Related
I have one form on one page and another on another website. How do i submit the data filled out on the first form to the other?
This is the code i have.
<form action="/action_page.php" method="get">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
Comments: <input type="text" name="comments"><br>
<button type="submit">Submit</button><br>
<button type="submit" formaction="http://www.example.com/formresult.asp")>Submit to another Form</button>
</form>
Ok so i want my users to fill out one form, but have the option to send to another form.
The reason i need this because i have different HELP DESK support teams. INSTEAD of a number of different contact forms on a lot of html pages in my directory, i want to just have the option to send to anyone of my HELP DESK support team from one form. ALL THE FORMS are the same, the PHP files are the same. The EMAIL addresses are the only thing different for each team member.
The OPTION to send to a URL is also helpful. I read it is called 'An absolute URL ' and 'A relative URL' as Attribute Values, but i think i am coding it wrong, it will not work for me.
type="submit" formaction="http://www.example.com/form.php")>Submit to another Form
If i can get some help by an example on the code i will need to do both of these actions - i can start to test my new gaming clan website live.
Thanks in advance
Please advise
Try this you have to change the attributes for action tag on each button click. I have change submit type in to button and placed a hidden input type as submit. hope this help you to move on.
<form action="/action_page.php" method="get" id="myForm">
First name:
<input type="text" name="fname">
<br>
Last name:
<input type="text" name="lname">
<br>
Comments:
<input type="text" name="comments">
<br>
<input type="submit" name="sub" id="sub" style="display:none;">
<button type="button" onClick="javascript:document.getElementById('myForm').setAttribute('action','action_page.php'); javascript:document.getElementById('sub').click();">Submit</button>
<br>
<button type="button" onClick="javascript:document.getElementById('myForm').setAttribute('action','http://www.example.com/formresult.asp'); javascript:document.getElementById('sub').click();">Submit to another Form</button>
<br>
</form>
I think your problem is in the
<form action="/action_page.php" method="get">
You should target it to your php like this:
<form action="/http://www.example.com/formresult.asp" method="get">
Then on the receiver file you should type the handling of the results
I dont really know angularjs. But this frontend from my client.
My form attribute was removed when i click nav-tabs.
actionTry="0" is attribute for ajax load status
i dont know, is this the main issue or there is another thing, because i try to add actionTry="0" manually after clicked nav-tabs. and Booom ! Nothing happend
-_-
i dont really know angluarjs. please let me know the solution.
For example, this is my first load form html :
<form class="formSetting" actionForm="bookClass" actionTry="0">
<input type="hidden" name="idSchedule" value="">
<input type="hidden" name="tanggalSchedule" value="">
<input type="hidden" name="returnPage" value="">
<button class="btn btn-blue3">RESERVE ACTIVITY</button>
</form>
but when i clicked the nav-tabs, actionTry="0" was removed.
<form class="formSetting" actionForm="bookClass">
<input type="hidden" name="idSchedule" value="">
<input type="hidden" name="tanggalSchedule" value="">
<input type="hidden" name="returnPage" value="">
<button class="btn btn-blue3">RESERVE ACTIVITY</button>
</form>
here is the video : Google Drive Video
If you want to test it. You can visit the online version : Online Version
E-Mail : dev#stackoverflow.com
Password : testtest
Please help me guys.
Thanks before :)
I have some comment forms that I want to not be used unless the user is logged in with Google+. I initially have the "submit" button on my forms hidden by the CSS display:none property. I call javascript when the user logs in to change it back to display:inline.
Is this a valid way to prevent anonymous users from posting, or am I still vulnerable by leaving the rest of the comment form open for writing and whatnot...is there some clever way to submit the form without the submit button?
<form action="" method="post" name="form1" id="make">
<fieldset>
<legend id="makelegend">Log in to Post a Reference</legend>
<input type="hidden" name="loginname" id="loginname" />
<input type="hidden" name="logintype" id="logintype" />
<input type="hidden" name="loginspecial" id="loginspecial" />
<input type="hidden" name="reply" id="reply" value="0" />
<input type="hidden" name="identity" id="identity" value="<?php echo htmlspecialchars($_GET['pageno']); ?>" />
<p><label for="posneg">Positive or Negative?
<select name="posneg">
<option value="p">Positive</option>
<option value="n">Negative</option>
</select></label></p>
<textarea name="comment" rows="5" cols="70"></textarea>
<input type="submit" id="submitter" value="POST" style="display:none;" />
</fieldset>
</form>
It is ABSOLUTELY NOT safe! You're just not displaying the data to the user, but anyone who looks at the code can still find it - or just send the request manually. I can't stress this enough: ALWAYS use server-side validation! It's fine to validate things in the browser as well, but it's not a substitute for proper security measures.
i'd like to pop up a form when click a link.
<a title='%s' onclick='return popupform()' href='#'> ABC </a>
the form is like:
<form id="contactus" action="javascript:submit_form()" method="post" accept-charset="UTF-8">
<input type="hidden" name="submitted" id="submitted" value="1">
<label for="chinese">Chinese: </label><br>
<input type="text" name="cs" id="cs" value="" maxlength="50"><br>
<label for="english">English:</label><br>
<input type="text" name="en" id="en" value="" maxlength="50"><br>
<input type="submit" name="Save" value="Save">
<input type="submit" name="Delete" value="Delete">
<input type="submit" name="Add" value="Add">
<input type="submit" name="Close" value="Close">
</form>
how to achieve it?
Wrap your form in a div:
<a title="%s" class="show_form" href="#"> ABC </a>
<div id="form_wrapper">
<form id="contactus" action="javascript:submit_form()" method="post" accept-charset="UTF-8">
... truncated for brevity
</form>
</div>
And some CSS:
#form_wrapper {
display:none;
}
And then some JavaScript using jQuery:
$('a.show_form').on('click', function() {
$('#form_wrapper').show();
});
And if you really mean a popup window, or commonly called a "modal" window, look here: http://jqueryui.com/demos/dialog/#modal-form
Pop-ups are simple div elements on the page that would be initially hidden and then revealed when some event takes place, like a mouse click. You then need to adjust the look of that div so it appears as a pop-up to the user, i.e. center the div on the page, raise its z-index so it layers above all, adjust the opacity to give the dimming effect, and so on. Obviously it is a lot of work if you decide to roll your own. Otherwise, if you are OK with using jquery, you can take advantage of the jqueryui dialog element
I've searched for a solution to this issue all over the web. After no success, here I am. I have a form that where I have 3 fields that should contain data. Field 1 is the Zip Code, Field 2 and 3 are City and State respectively.
The JS function getCityByZipHome and getStateByZipHome dynamically return the city and state and insert the values into the the city2 and state2 input fields.
For whatever reason, when I submit the form via mouse-click.. I see the data via $_POST. If the users presses ENTER, the data is never captured and I never see that data from the hidden fields.
Any idea what's wrong here? Note, I've tried almost all the event handlers onblur, onclick, onchange..etc.
<form method="post" name="something" action="xxSome.php">
<div class="s_row">
<label for="zippy">Enter Zip Code</label>
<input id="zipcode_home" tabindex="2" type="text" onkeypress="javascript:getCityByZipHome(document.getElementById('zipcode_home').value, this.form.elements['city3']);javascript:getStateByZipHome(document.getElementById('zipcode_home').value, this.form.elements['state3']);" name="zipcode_home"/>
<input id="state3" name="state3"type="hidden"/>
<input id="city3" name="city3" type="hidden"/>
<input type="submit" value="Start Now!"/>
</div>
</form>
I've tried adding onsubmit # the form level as such:
<form method="post" name="something" action="xxSome.php" onsubmit="javascript:getCityByZipHome(document.getElementById('zipcode_home').value, this.form.elements['city3']);javascript:getStateByZipHome(document.getElementById('zipcode_home').value, this.form.elements['state3']);">
<div class="s_row">
<label for="zippy">Enter Zip Code</label>
<input id="zipcode_home" tabindex="2" type="text" name="zipcode_home"/>
<input id="state3" name="state3"type="hidden"/>
<input id="city3" name="city3" type="hidden"/>
<input type="submit" value="Start Now!"/>
</div>
</form>
And I've tried onblur without any luck # the input level as such:
<form method="post" name="something" action="xxSome.php">
<div class="s_row">
<label for="zippy">Enter Zip Code</label>
<input id="zipcode_home" tabindex="2" type="text" onblur="javascript:getCityByZipHome(document.getElementById('zipcode_home').value, this.form.elements['city3']);javascript:getStateByZipHome(document.getElementById('zipcode_home').value, this.form.elements['state3']);" name="zipcode_home"/>
<input id="state3" name="state3"type="hidden"/>
<input id="city3" name="city3" type="hidden"/>
<input type="submit" value="Start Now!"/>
</div>
</form>
After all the messing around, I actually never solved the issue; rather, I disabled the ENTER key as a submit method.
I have some pretty serious time constraints, but I'm sure this will come up later and I will definitely come back to this issue.
You should do the getcitybyzip and getstatebyzip in the form onSubmit.
Change the type of the submit to button and then add on onClick method to it. ie instead of make it but you need an id on the form to do that. I would be interested though in finding the cause of what is going wrong. Did you try firebug?