display a message on first page (search.jsp)

X-Application Version: 3.1.3,
Tamino Version : 3.1.1
Platform : Widows2000
WebContainer : Tomcat 3.3
JDK Version : 1.3.1
Hi,
I have the following problem. I have generated the application and now I would like to display a message on the first page (search.jsp) if you click on the “Search” button and all the input field are empty. Could you give me any suggestions how to do it.
Best regards,
vs

Hi,

if you will have a look onto the search.jsp page,
you will recognize the code invoking the search button:
e.g.

Instead of submitting immediatley ou can bypase it
when referencing an other javascript function (e.g. ‘mySubmit’).


This function declared on this page could propably look similar like:

<BR><script language="JavaScript"><BR>function mySubmit()<BR>{<BR>  //test on field 'inputName' on 'Form1'<BR>  if (document.Form1.inputName.value=""){<BR><BR>}<BR>	document.Form1.txtWert.focus();<BR>	<BR>	varWertFlag = false;<BR>	varOperatorFlag = true;<BR>	varOperatorValueFlag = "and";	<BR>}<BR></script><BR>

Hi,

if you will have a look onto the search.jsp page,
you will recognize the code invoking the search button:
e.g.

Instead of submitting immediatley ou can bypase it
when referencing an other javascript function (e.g. ‘mySubmit’).


This function declared on this page could propably look similar like:

<BR><script language="JavaScript"><BR>function mySubmit()<BR>{<BR>  //test on field 'inputName' on 'Form1'<BR>  if (document.forms[form1].inputName.value=""){<BR>     alert("No value!");<BR>  } else {<BR>     document.forms['form1'].submit()<BR>  }<BR>}<BR></script><BR>



Ok, I hope this will help you.

Bye Thorsten

Hi Thorsten,
Thank you for your suggestions, but unfortunately I still have a problem. Instead of the message I have the text of the function. I think I have done what you suggested, but maybe I have been doing any mistake. My code now looks like:
(…)
Query strony

.link {
COLOR: #000000; FONT-WEIGHT: bold; TEXT-DECORATION: none
}
A {
COLOR: #000000; FONT-WEIGHT: bold; TEXT-DECORATION: none
}
A:link {
FONT-WEIGHT: bold
}
A:hover {
COLOR: #000000; FONT-WEIGHT: bold; TEXT-DECORATION: underline
}







xapp:module
(…)




<xapp:action type=“query” arg=“${querySearch$}” form=“form1”>




</xapp:action>
(…)
Regards,
vs

Hi,

I have tested a solution, and this should work:

<BR><script language="JavaScript"><BR>function mySubmit(){  <BR>  //test on field 'inputName' on 'Form1'  <BR>  if (document.forms[form1].inputName.value==""){    <BR>    alert("No value!");  <BR>    return false;<BR>} else {     <BR>   return true;<BR></script><BR>...<BR><form name="Form1" method="post" action="your next page" <B>onSubmit="return mySubmit()"</B>><BR>...<BR></form><BR>



You will have to change the default submit behaviour by setting the ‘onSubmit’-attribute.
This will point to your function.

Ok. Hope this will help you

Bye
Thorsten

Hi again,
Thank you very much for your help. Your previous suggestion was OK, but I made a little mistake using “if” condition. Now it works correctly. Thank you.
Regards,
vs