input box remains visible behind jquertyui dialog - html

I used jqueryui dialog . There are input boxes in the page. When the dialog appears on clicking a link, then the input boxes are visible from behind the dialog body resulting into bad visibility of the dialog body text etc.
$(function() {
$( "#dialog" ).dialog();
});
HTML:
<input type="text" value="" class="input_box" />
<input type="text" value="" class="input_box" /><input type="text" value="3" class="input_box" />
<input type="text" value="" class="input_box" /><input type="text" value="3" class="input_box" />
<input type="text" value="" class="input_box" /><input type="text" value="3" class="input_box" />
<input type="text" value="" class="input_box" /><input type="text" value="3" class="input_box" />
<input type="text" value="" class="input_box" /><input type="text" value="3" class="input_box" />
<input type="text" value="" class="input_box" /><input type="text" value="3" class="input_box" />
<input type="text" value="" class="input_box" />
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
How to refrain the input boxes from distorting the modal window body part?

If you specify modal:true the background will be grayed out.
$(function() { $( "#dialog" ).dialog({modal:true}); });
If you want the entire background to be hidden you can change the overlay to a solid color using CSS:
.ui-widget-overlay{
background: gray;
opacity: 1;
}
JSFiddle: http://jsfiddle.net/WBstB/1/

Related

Search Image by specified size

I got some help a while ago to make something that searches for images on google with a preset size. Now I want to know if it would be possible to change this HTML5 so that you can type in your own size to use instead of a preset one. So if I type 54 in a text box labeled width and 10 in one labeled height, I would only get results with images that have a width of 54 and a height of 10.
<form action="https://www.google.com/search" method="get">
<input name="tbm" value="isch" type="hidden">
<input name="tbs" value="isz:ex,iszw:10328,iszh:7760" type="hidden">
<input name="q" size="35" type="text" placeholder="zelda">
<input type="submit" value="Find 10K images">
</form>
<script>
function addSpecs() {
document.getElementsByName("tbs")[0].value =
"isz:ex,iszw:"
+ document.getElementById("w").value
+ ",iszh:"
+ document.getElementById("h").value;
}
</script>
<form action="//www.google.com/search" method="get">
<input type="hidden" name="tbm" value="isch" />
<input type="hidden" name="tbs" value="" />
w: <input type="text" id="w" /><br />
h: <input type="text" id="h" /><br />
<input type="text" name="q" size="35" /><br />
<input type="submit" value="Find images" onclick="addSpecs();" />
</form>

Accessing the value that's not part of the form

In my html I have a combo box which list all the available usertypes and then the input varies by what the user selects on the combo box so you can see that I have my onchange.
But my question is how would I be able to access the value of the selected combo box? Is it possible to get its selected value even it is not a part of the form? I've already tried to have only one form that is
<form action="" name="form1" method="post">
<select id="usertype" name="usertype" class="dropdown-select" onfocus="getPrevious()" onchange="set()" >
<option value="1" selected="selected">Chairperson</option>
<option value="2">Dean</option>
<option value="3">Faculty</option>
<option value="4">Staff</option>
<option value="6">Admin</option>
</select>
<div id="formpage_Chairperson" style="visibility: visible; display: block;">
<input type="text" value="" name="A" />
<input type="text" value="" name="B" />
<input type="text" value="" name="C" />
<input type="text" value="" name="D" />
<input type="text" value="" name="E" />
<input type="text" value="" name="F" />
<input type="Submit" value="Submit Form" name="submitForm" />
</div>
<div id="formpage_Chairperson" style="visibility: hidden; display: none;">
<input type="text" value="" name="A" />
<input type="text" value="" name="B" />
<input type="text" value="" name="C" />
<input type="Submit" value="Submit Form" name="submitForm" />
</div>
</form>
But when I clicked the Submit Form nothing happens. You can see that I'm choosing only what to display because different usertypes (e.g. Chairperson, Dean, etc) have also different inputs. So I make different forms for each particular usertypes. But then it throws an error ' Undefined index: usertype ' and I know that is because it's not part of the form.
So can you give me some advice on how will I be able to come up with this properly? Thank you.
Here is my html code:
<select id="usertype" name="usertype" class="dropdown-select" onfocus="getPrevious()" onchange="set()" >
<option value="1" selected="selected">Chairperson</option>
<option value="2">Dean</option>
<option value="3">Faculty</option>
<option value="4">Staff</option>
<option value="6">Admin</option>
</select>
<form action="" name="form1" method="post">
<div id="formpage_Chairperson" style="visibility: visible; display: block;">
<input type="text" value="" name="A" />
<input type="text" value="" name="B" />
<input type="text" value="" name="C" />
<input type="text" value="" name="D" />
<input type="text" value="" name="E" />
<input type="text" value="" name="F" />
<input type="Submit" value="Submit Form" name="submitForm" />
</div>
</form>
<form action="" name="form1" method="post">
<div id="formpage_Dean" style="visibility: hidden; display: none;">
<input type="text" value="" name="A" />
<input type="text" value="" name="B" />
<input type="text" value="" name="C" />
<input type="Submit" value="Submit Form" name="submitForm" />
</div>
</form>
This is the Javascript for handling the onchange event of the combo box:
var prev = ""
function pagechange(topage) {
var page;
if (prev.length > 0) {
page = document.getElementById('formpage_' + prev);
if (page)
page.style.visibility='hidden';
page.style.display = 'none';
}
page = document.getElementById('formpage_' + topage);
if (!page)
return false;
page.style.visibility='visible';
page.style.display = 'block';
prev = topage;
return true;
}
function set(){
var e = document.getElementById("usertype");
var selection = e.options[e.selectedIndex].text;
pagechange(selection);
}
Not sure how you wanted to "access" it. I'm assuming you mean with the rest of the form data, so you could do something like the following:
function pagechange(topage) {
var page;
if (prev.length > 0) {
page = document.getElementById('formpage_' + prev);
if (page) {
page.style.visibility='hidden';
page.style.display = 'none';
}
page = document.getElementById('formpage_' + topage);
// create hidden input field and append to form
var input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "page");
input.setAttribute("value", topage);
page.appendChild(input);
// end of changes
if (!page)
return false;
page.style.visibility='visible';
page.style.display = 'block';
prev = topage;
}
return true;
}
Also, you were missing a closing bracket on your if (prev.length > 0), so I closed it right before the return true;. You may need to adjust depending on your logic.
Hope this gets you close.

Submit button on form B attempts to submit form A instead

I have a superfish menu containing two forms, a search box in superfish tab 1 and a newsletter signup in tab 3. The search form works fine, and the newsletter signup works fine so long as the search form isn't present on the page. But when both are present, the submit button on the newsletter signup form appears to try and submit a search instead, which not only doesn't sign the user up for the newsletter, but it doesn't search for anything either.
My code goes like this:
<form class="search-form" action="/search/node" method="post" id="search-form" accept-charset="UTF-8"><div><div class="container-inline form-wrapper" id="edit-basic"><div class="form-item form-type-textfield form-item-keys">
<input type="text" id="edit-keys" name="keys" value="" size="20" placeholder=" Search this site" maxlength="255" class="form-text" />
</div>
<input type="submit" id="edit-submit" name="op" value="Go" class="form-submit" /></div><input type="hidden" name="form_build_id" value="form--JTbYKjZwG8SjIstLVU7J0HOiZZiSoB88bE4VoRYTG4" />
<input type="hidden" name="form_token" value="HoVlLGidOtcgITb3XmNhvH7mKKzW8ldmnahr3t0HGAU" />
<input type="hidden" name="form_id" value="search_form" />
<many other divs>
<form class="webform-client-form" enctype="multipart/form-data" action="/content/newsletter-signup" method="post" id="webform-client-form-22" accept-charset="UTF-8"><div>
<div class="form-item webform-component webform-component-email webform-container-inline" id="webform-component-email">
<input class="email form-text form-email required" type="email" id="edit-submitted-email" placeholder="Email address" name="submitted[email]" size="24" />
</div>
<div class="form-item webform-component webform-component-textfield webform-container-inline" id="webform-component-name">
<input type="text" id="edit-submitted-name" name="submitted[name]" value="" placeholder="Name" size="14" maxlength="128" class="form-text required" /> <input type="submit" id="edit-submit" name="op" value="Submit" class="form-submit" />
</div>
<input type="hidden" name="details[sid]" value="" />
<input type="hidden" name="details[page_num]" value="1" />
<input type="hidden" name="details[page_count]" value="1" />
<input type="hidden" name="details[finished]" value="0" />
<input type="hidden" name="form_build_id" value="form-I8MgMoURjB6BhqJATKhhNZ5nAUwk855bGWgxH75Gs5Q" />
<input type="hidden" name="form_token" value="IKALClB6fmkRPFA6Ko8VIbBN2uDEwpVBxFM6w2_2JAo" />
<input type="hidden" name="form_id" value="webform_client_form_22" />
</div></form>
How can I get the submit button on the second (newsletter signup) form to submit that form and not the search?

HTML form input steals focus/ focus gets shifted

For some reason the focus keeps getting shifted from any of the address field to the credit card field on my HTML form.
So onclick of address fields, the focus goes back to the credit card field.
It's probably something really simple, but can anyone help?
http://jsfiddle.net/xYbsz/
<form name='order-validation'>
<p><label>email: <input type="email" title="email" id="emailAddress" name="email" value=""></label></p>
<p>
Phone: <select name="countrycode" style="display: inline;">
<option value="44" selected>UK (+44)</option>
<option value="1">USA (+1)</option>
<option value="213">Algeria (+213)</option>
</select><input type="tel" name="phone" id="id_tel" required pattern="(\+?\d[-.]*){7,13}" title="international, national or local phone number"/></p>
<img class="cc-img" id="visa-card-img" src="visa.jpg" />
<img class="cc-img" id="mastercard-card-img" src="mastercard.jpg" />
<img class="cc-img" id="amex-card-img"src="american-express.jpg" />
<p><label>credit card: <input type="text" id="cc_number" pattern="[0-9]{13,16}"><br />
<img class="cc-security-code" id="visa-sec-code" src="cvv.gif" />
<img class="cc-security-code" id="amex-sec-code" style="display: none;" src="amex-sec-code.gif" /><br />
Address:
<input type="text" name="newCreditCardStreet" size="35" tabindex="5" value="" id="id_creditCardStreet"><br />
Town/City:
<input type="text" name="newCreditCardLocality" size="35" tabindex="5" value="" id="id_creditCardLocality"><br />
Country:
<input type="text" name="country" id="id_country">
<p><input type="button" name="submit" value="Submit" /></p>
<p id="test"></p>
</form>
The label tag for cc_number is not closed.
<label for="cc_number">credit card:</label>
<input type="text" id="cc_number" pattern="[0-9]{13,16}"><br />
Also I noticed in the markup the label tags are wrapping the inputs. This is unnecessary:
<label>email:
<input type="email" title="email" id="emailAddress" name="email" value="">
</label>
Instead use the for attribute:
<label for="emailAddress">email:</label>
<input type="email" title="email" id="emailAddress" name="email" value="">
Working Example http://jsfiddle.net/xYbsz/1/

Form Code: How to get submit button next to text box

I just can't figure out to get the "submit" button to the right of the text box for the form found at the top of the loop on this page: http://www.babysavers.com.
The code I'm using is here:
<center>
<div style="width: 625px; height: 70px; border-style: dotted; border-color: #d7345a; border-width: 1px; padding: 5px;">
<form action="http://www.feedblitz.com/f/f.fbz?AddNewUserDirect&ajax=4" method="POST" name="FeedBlitz_9fe455b8521611e29f67003005ce8903">
<h3>Join over 8,900 subscribers! Enter your email below for FREE Updates:</h3>
<input style="display:none" type="text" name="EMAIL" value="" maxlength="64" size="65">
<input type="hidden" name="EMAIL_" value="" maxlength="64" />
<input type="hidden" name="EMAIL_ADDRESS" value="" maxlength="64" />
<input type="hidden" name="FEEDID" value="873069" /> <input type="hidden" name="cids" value="1" />
<input type="hidden" name="PUBLISHER" value="24085942" />
<input onclick="FeedBlitz_9fe455b8521611e29f67003005ce8903s(this.form);" type="button" value="Subscribe!" />
</form></div><script type="text/javascript" language="Javascript">// < ![CDATA[
// < ![CDATA[
// < ![CDATA[
// < ![CDATA[
function FeedBlitz_9fe455b8521611e29f67003005ce8903i(){var x=document.getElementsByName('FeedBlitz_9fe455b8521611e29f67003005ce8903');for(i=0;i<x .length;i++){x[i].EMAIL.style.display='block';
x[i].action='http://www.feedblitz.com/f/f.fbz?AddNewUserDirect';}}
function FeedBlitz_9fe455b8521611e29f67003005ce8903s(v){v.submit();}FeedBlitz_9fe455b8521611e29f67003005ce8903i();
// ]]></script><br></center>
I know my code is sloppy, but all I want to do is line up the Submit button so it's to the right of the text box, not underneath it. Any help would be appreciated.
Set your display to inline rather than none:
style="display: inline;"
Try this change (display: inline):
<input type="text" size="65" maxlength="64" value="" name="EMAIL" style="display: inline;">