Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

NEED HELP - adding javascript (onSubmit) to a form


lleemon

Recommended Posts

I am trying to modify /catalog/admin/orders.php. My plan is when you click on a order you get to a page that you can change the status/comments. I would like to be able to put some javascript into this so when I click on the update button and the status is Shipped and Comments textarea has no value I do not want to continue.

 

My solution was in includes/function/html_output.php their is a function called tep_draw_form. I want tried to actually change this but it didn't seem to reflect on my page. Is there a different place where tep_draw_form could be coming from?

 

I want to add to tep_draw_form:

... '"' . ' onSubmit(return fncheckcomment(this)';

 

I also have added the following in the orders.php header area:

<script language="JavaScript">

function fncheckcomment(form) {

 var v_Comment = form.comments.value.length;

 var v_Status = form.status.value;

 

 if (v_Comment == 0 && v_Status == 3 ){

	 alert("Missing comment");

	 return false;

 }

}

</script>

 

Can anyone help me get the onSubmit added to this form?

Thanks.


Link to comment
Share on other sites

I believe this was the issue. The funny thing is that I have Dreamweaver MX and did a search within the catalog folder and it only brought up the other htm_output.php file. Kind of curious why this one didn't show up.

 

Thanks for the insight!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...