Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Form submit button inactive

Posted on 2006-07-15
2
Medium Priority
?
2,990 Views
Last Modified: 2008-01-09
I have two forms. I would like to make the second forms submit button inactive if anything is typed into the first forms 'f_name' field.

How do I do that with Javascript?

<form name="form1" method="post" action="page.html">
  <input type="text" name="f_name">
  <input type="hidden" name="step" value="2">
  <input type="submit" value="Next">
</form>

<form name="form2" method="post" action="page.html">
  <input type="hidden" name="step" value="3">
  <input type="submit" value="Skip this step">
</form>
0
Comment
Question by:silver00x00
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
Joe earned 500 total points
ID: 17117990
<script language="JavaScript">
         function checkForButtonDisable(fname){
              if(fname.value.length > 0){
                 document.getElementById("skipButton").disabled = true;
              }else{
                   document.getElementById("skipButton").disabled = false;
             }
         }
</script>

<form name="form1" method="post" action="page.html">
  <input type="text" name="f_name" onchange="checkForButtonDisable(this);">
  <input type="hidden" name="step" value="2">
  <input type="submit" value="Next">
</form>

<form name="form2" method="post" action="page.html">
  <input type="hidden" name="step" value="3">
  <input type="submit" value="Skip this step" id="skipButton">
</form>
0
 

Author Comment

by:silver00x00
ID: 17135757
thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question