multiple forms - html

For example, would like 5 checks boxes to have their own submit button and the other 5 to have their own submit. Should be independednt of each other but they are not grouped together in the html page.
Do I nest the other form? Do I put them under the same name and if so how do I distinct the submit? Submit seems to submit the form name element, not the elements names within the form. (Using HTML and JS)
Thanks.

Your clarification doesn't make too much sense from a user standpoint. Perhaps you want something like this:
<form action="/cgi-bin/Lib.exe" method="post" name="checks" id="Form1">
<input type="checkbox" name="user" value="'$NAME'" id="Checkbox1" />
<input type="checkbox" name="user" value="'$NAME'" id="Checkbox2" />
<input type="submit" value="DELETE" id="Submit1" name="Submit1" />
</form>
<form action="/cgi-bin/Lib.exe" method="post" name="checks" id="Form2">
<input type="checkbox" name="guest" value="'$NAME'" id="Checkbox1" />
<input type="checkbox" name="guest" value="'$NAME'" id="Checkbox2" />
<input type="submit" value="DELETE" id="Submit2" name="Submit2" />
</form>

I'd use the button element. Try this link: http://particletree.com/features/rediscovering-the-button-element/
Basically you use them as your submits. Firefox correctly sends the value attribute but IE sends the innerHTML. But they all come across as name=value/innerHTML.
So for example, using PHP, you could use
if (isset($_POST['nameOfButtonElement'])) {
echo 'user clicked this button';
}
EDIT: IE6 (surprise surprise) doesn't handle this correctly at all. See this question: IE 6 and the multiple button elements all sending their name & values

Maybe something like that (this way you can control it):
function ava_aken_hp()
{
// I use blank form with hidden fields to populate it with values from POST.
document.blank.action="https://www.mypage.com";
document.blank.elements["CHECK"].value=....;
...
document.blank.submit();
}
// In your form:
<input type="submit" value="Submit1" onclick="ava_aken_hp();">

Related

How to send the contents of 1 text area to 2 forms?

I currently have a form that looks like this:
<form action="http://blahblahblah.com/c2dm_send.ashx"; method="post" name="push">
<input type="hidden" name="publisherid" value="blahblah" />
<input type="hidden" name="username" value="YOURUSERNAME" />
<input type="hidden" name="pass" value="YOURPASS" />
<input type="hidden" name="appid" value="YOUROTHERINFO" />
<input type="hidden" name="topics" value="topic_name" />
<input type="hidden" name="topics" value="" />
<p align="center">Notification Message:<br />
<textarea style="width:200px;height:100px;" name="pushmessage"></textarea><br />
<input type="submit" value="Push" />
</p>
</form>
Is it possible to have that same textarea apply in a second form? I would like it if I could have an end product where the user types their message into 1 textarea and hits 1 send button but the contents of the text area are sent to two different URLs and with different "hidden" hard-coded Username and Password information for each form it is sent to.
It looks like you're using ASP.NET. You could always store the information in a session variable and use it on any page you like. Here is the documentation on session variables: http://msdn.microsoft.com/en-us/library/ms178581%28v=vs.140%29.aspx
Not in a direct way. You could make a hidden text-area in the second form, and before submiting the second form, copy the value of the visible text-area in the first form into the invisible text-area in the second form.
In that way, it looks as if the second form uses the text-area form the first form!
I did this before. If you need any help with code, you can ask :)

HTML5 Validation Not Trigering

I'm working on making client side validation for inputs.
I had had been using PHP to do it all.
Needless to say things got cluttered very quickly.
So I looked in to JS and HTML5 and want to move in to that system for validation.
The messages I want to show are like this:
I know that these are done with the the <input type="email"> tag.
After some help, I was pointed to this page html5rocks.
However I cant seem to get anything to popup.
I copied code straight from there site and nothing.
<input id="foo" type="number" max="2" value="1" />
<input id="bar" type="number" max="2" value="3" />
<script>
document.getElementById('foo').validity.rangeOverflow; //false
document.getElementById('bar').validity.rangeOverflow; //true
</script>
What am I missing to make the notification appear?
That popup is a new implementation in HTML5. Just create an input field like this:
<input type="email">
The popup appears automatically when the form is submitted if the input isn't an email-address.
More about the new input fields in HTML5 is at W3Schools.
Form must be submitted before validation kicks in.
So you have to add a button with the type of submit so like so:
<input type="submit" value="blah">
And then you have to enclose all the fields/inputs in a <form> and </form> tag.
here is the working code:
<form>
<input id="foo" type="number" max="2" value="1" />
<input id="bar" type="number" max="2" value="3" />
<input type="submit" value="blah">
</form>
<script>
document.getElementById('foo').validity.rangeOverflow; //false
document.getElementById('bar').validity.rangeOverflow; //true
</script>

Using HTML input element (type="submit"), how can we customize the GET field?

Using <form method="get"> element including <input type="submit"> element, we can have a way to GET a web page with some fields specified by the <input type="text" name="studentId"> elements, but can I customize those fields?
For example: I always want to add a action=true to the GET url to let the URL be something like this: http://example.com/?studentId=123&action=true?
Use <input type="hidden" name="action" value="true" />
inside your form.
You can add a hidden form field, though the name action is not a good one, as form has an action attribute and this name can conflict when scripting the form:
<input type="hidden" id="something" name="something" value="somthingelse" />
<div id="gbqffd">
<input type="hidden" value="en" name="h1">
<input type="hidden" value="d" name="tbo">
<input type="hidden" value="search" name="output">
<input type="hidden" value="psy-ab" name="sclient">
</div>
Google always has the answer; in this case I never had to do a search just look at the source :)

IE9 is auto-submiting form when <a> links clicked

While using IE9, every link (when clicked) the search form is being submitted. Every link seems as if it is redirecting to the action value of the search form.
There is no java script attached to the form element.
<form action="/my-search-url" method="post">
<input type="submit" value="search" />
<input type="text" value="" />
</form>
The issue was with the order of the form elements. Apparently the original developer decided to place the submit button before any input elements. By putting the submit input last (or removing it) fixed this issue.
<form action="/my-search-url" method="post">
<input type="text" value="" />
<input type="submit" value="search" />
</form>

Form search submission help

Hey guys, I have a form and there are 4 buttons possible for the user to click to submit. One searches for everything, another for users, another for clips, and the fourth for topics. Now my question is that the buttons has name=category and value=(type of search) and what I intend to do is send the user to the search result page with the category=value in the address bar(using GET method). This is working fine on firefox but it isn't working at all using google chrome. Any help? Here's the code:
<form method="get" action="search.php" name="search" onsubmit="return Validate();">
<input type="text" class="searchit" title="Search..." name="search" id="search" /><br/>
<label><span> </span> <input name="submitter" type="submit" value="Search" class="searchsubmitButton" id="submitter" /></label>
<span class="searchfor">Search for:</span>
<label><span> </span> <input name="c" type="submit" value="Users" class="searchsubmitButton" id="submitter" /></label>
<label><span> </span> <input name="c" type="submit" value="Clips" class="searchsubmitButton" id="submitter" /></label>
<label><span> </span> <input name="c" type="submit" value="Topics" class="searchsubmitButton" id="submitter" /></label>
</form>
because your input fields are inside the <label></label> tags ?
Take a look at this thread: Safari and Chrome back button changes hidden and submit values in forms
The easiest solution I can think of is for you to create a hidden field called "c". Then, when the submit button is clicked, set the value (Users, Clips or Topics) in "c" hidden field first before submitting the form.