Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 130
  • Last Modified:

html and javscript problem

hi I have this code but when i run it it gives me run time error where i have defined the Form . It says Object expected.
Will appreciate any help.

<script language="Javascript/text">
function checkForm(myForm)
{
var thisForm = myForm;
If (thisForm.selectBooks.value=="")
{
return();
}
else
thisForm.submit();

}
</script>

//error is here It says object expected?
<FORM name="AABooks" method="post" action="sell_Books.php;">
<p>
<SELECT name="selectBooks" onChange="checkForm(document.AABooks);" style="font-size='13px'; font-family='MS Sans Serif'; font-weight=500; font-style='Normal'; text-decoration='None'; width=">
<OPTION value="" SELECTED style="background-color='';color=''">Select
<OPTION value="">-----------------------------

thanks

0
dskaushik
Asked:
dskaushik
1 Solution
 
russellshomeCommented:
You have a number of faults in your code. The one causing "object expected" error is caused by using language="Javascript/text".

Either use
<script type="text/javascript">

or
<script language="javascript">

Here is something that works (use indentation to reveal problems in your javascript code):

<script type="text/Javascript">
function checkForm(mySelector) {
     if (mySelector.value=="") {
          return;
     } else {
          mySelector.form.submit();
     }
}
</script>

<FORM name="AABooks" method="post" action="sell_Books.php">
<p>
<SELECT name="selectBooks" onChange="checkForm(this);" style="font-size='13px'; font-family='MS Sans Serif'; font-weight=500; font-style='Normal'; text-decoration='None'; width=''">
<OPTION value="" SELECTED style="background-color='';color=''">Select
<OPTION value="">-----------------------------
<OPTION value="something">Submit the form
</SELECT>
</FORM>

0
 
umangjoshiCommented:
pls change this part

onChange="checkForm(document.AABooks);"

to

onChange="checkForm(AABooks);"
0
 
vitanzaCommented:
here is another problem - on this line:

<FORM name="AABooks" method="post" action="sell_Books.php;">

you should get rid of the semicolon after "sell_Books.php"
because you have the semicolon, the browser thinks sell_Books.php is javascript code
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
COBOLdinosaurCommented:
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
 
russellshomeCommented:
Recommendation: Points to me. I have answered by pointing out the cause of the error AND providing an alternative.
0
 
COBOLdinosaurCommented:
It is time to clean this abandoned question up.

I am putting it on a clean up list for CS.

<recommendation>
pointst to russellshome

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now