I have a form with a variety of text boxes, and these have submit buttons to click to submit to the form, eg:
<td class='under' style='text-align: right;'>search by title:</td>
<input name='CCtitleSearch' type='text' value="" />
<input type='submit' name='CCtitleBtn' id="CCtitleBtn" value='search' class='buttons' />
<td class='under' style='text-align: right;'>search by course:</td>
<input name='CCcourseSearch' type='text' value="" onclick="CCbtnFocus();" />
<input type='submit' name='CCcourseSearchBtn' id="CCcourseSearchBtn" value='search' class='buttons' />
when I enter the page, the first button is used to submit the form when return key is pressed. What I want to do, is if someone types into the lower box, the 'CCcourseSearchBtn' is selected as the button to be submitted (as if someone had clicked it)
This didn't work, using the onclick in the CCcourseSearch textbox:
var ccbtn = document.getElementById("CCcourseSearchBtn");
Any ideas gratefully received.
The simplest way is to put each button and their accompanying fields in a form of their own.
input fields and buttons for form 1
input fields and buttons for form 2