Link to home
Start Free TrialLog in
Avatar of ramareddyj
ramareddyj

asked on

how to write an error message on a jsp by calling a js function from jsp

hi ,
i am facing the problem of showing an error message on a jsp page once the user clicks a link.

The error message is to be shown on the same page where the link is shown.

the code is as below

(<html:link href="#" onclick="document.write(indexEnableInMatch('pmformforindexing'))">
                                                                  <bean:message bundle="POIMatches" key="pmr.details.link" />
                                                                       </html:link>)


not abel to understand what code should i write on the the event onClick?

kindly help me

regards,
jatinder

Avatar of jpolin1
jpolin1

Looks like you are using struts, why not use its built in error checking?

If you want it to display an error message w/o a page refresh(another request-responce cycle),
then you need some DHTML, like swapping layers in and out via javascript.

Let me know which way you are trying to go.
Avatar of ramareddyj

ASKER

i am using struts framework. and i have decide to show the error message in a textbox which will be disabled all the time

what i am trying to do now is on execution of following line
onclick="indexEnableInMatch(<%='pmformforindexing'%>)">

my indexEnableInMatch() will be called and inside this function i am going to set the value of a text box to my error message

function indexEnableInMatch(FormName)
{
      alert(FormName);
      FormName.hiddenLabel.value="my error emssage ";

}

now i am facing problem in passing  the parameter "pmformforindexing" which is nothing but my action form.

any way to resolve this??

regards,
jatinder
ASKER CERTIFIED SOLUTION
Avatar of jpolin1
jpolin1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
can i make the text color "RED" for a disabled text box?????
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>>>>   input="NameOfJSP"

I meant    input="NameOfJSP.jsp"