Kelly,

The difference between html:submit and input is:

Struts html:submit automatically populates the form for you
while
input you have to explicitly populate it

Your JavaScript must be something like this:
function exeBtnSai(form)
{
   form.action="beans.TstJspCtaAction.do";
        for (var i=0; i < document.forms[x].elements.length; i++) {
                document.forms[x].elements[i].value =
form.elements[i].value;
        }
   form.submit();
}

where 'x' is the index of the form in your page. If you have just one form
'x' = 0.
or forms[x] can be the name of the form.

"boa sorte",
Leonardo

-----Original Message-----
From: Kelly Prudente Pereira [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 20, 2002 9:36 AM
To: 'Struts Users Mailing List'
Subject: Problem using button instead of submit


Hi folks,
       
        I'm new in the list, but i really need your help. I have the
follwing problem:
        In my Jsp I have two buttons: btnCnf and btnSai. I'm using the
framework struts and I'd like to obtain their values. I have a javascript
which i call to submit the form. Everything works fine while i'm working
inside Jbuilder and in the action i could obtain the button values. But when
i test in the ie 5.0 env, it seems to ignore my setBtnCnf and setBtnSai in
the ActionForm and I receive a null value to the buttons.

See the code:

In the jsp:
....
        <TD COLSPAN=11 ROWSPAN=1 WIDTH=110>
      <INPUT NAME="btnCnf" TYPE="BUTTON" TABINDEX=9 VALUE="Confirma"
SIZE=110
             OnClick="exeCnf(this.form)"><br>
      </TD>
      <TD>
      </TD>
        <TD>
      </TD>
      <TD COLSPAN=11 ROWSPAN=1 WIDTH=110>
      <INPUT NAME="btnSai" TYPE="BUTTON" TABINDEX=10 VALUE="Sai" SIZE=110
             OnClick="exeBtnSai(this.form)"><br>
      </TD>
....

In the javascript:

function exeBtnSai(form)
{
   form.action="beans.TstJspCtaAction.do";
   form.submit();
}

function exeCnf(form)
{
  form.action="beans.TstJspCtaAction.do";
  form.submit();
}

        It just works in the if i choose to put their type as submit, but I
cant't use this here.
        Please, does anybody knows what the problem is.

        Thanks in advanced


Kelly Prudente Pereira<?xml:namespace prefix = o ns =
"urn:schemas-microsoft-com:office:office" />

Analista de Sistemas - NDS

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

F�ton* Inform�tica e Servi�os

Fone: (61) 328 5060 R.:222


 



  


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to