You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by anoe <ki...@mazarredos.com> on 2007/06/08 15:28:29 UTC

clearing input texts

hi all, i guess this is an easy one, but was looking around and couldn't find
an answer. Ok, i've got this combo and these inputText fields, i also have
an <t:commandButton type="reset">. When i choose st in the list my
inputTexts are updating, when i push the 'reset' button is not doing
anything. Well, actually it is doing something, it's reverting the inputs to
their original state, that is, to the last value selected in the combo :).
But what i want is the inputs to clear, not to reset. I guess i should do
that with javascript, but i am not sure about how to access myfaces
javascript components from within a funcition. Any help? tx in advance.
-- 
View this message in context: http://www.nabble.com/clearing-input-texts-tf3889797.html#a11026399
Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: clearing input texts

Posted by anoe <ki...@mazarredos.com>.
hi fintan

when u sent your reply, i was having a look in here:
http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces

the link you sent me seems to solve the problem but in the server side, not
in the client side.

Reading the other article i solved my problem with this code:

<script>

function resetCampos(formulario) {
	formulario.elements[formulario.name + ':nombrePacNuevo'].value=''
	formulario.elements[formulario.name + ':apellidosPacNuevo'].value=''
	formulario.elements[formulario.name + ':documentoPacNuevo'].value=''
	formulario.elements[formulario.name + ':movilPacNuevo'].value=''
}

</script>
 ...
	<input jsfc="t:commandButton" value="Borrar campos" 
		onclick="resetCampos(this.form)"/>

I'm using facelets, and reusing this part of a form in different pages (and
different forms), this way i make my code independent of the form i am
within.

tx 4 your help.


Conway. Fintan (IT Solutions) wrote:
> 
> Hi Anoe,
> 
> Does any of the information on this page help?
> http://wiki.apache.org/myfaces/ClearInputComponents
> 
> Regards,
> 
> Fintan
> 
> -----Original Message-----
> From: anoe [mailto:kike@mazarredos.com] 
> Sent: 08 June 2007 14:28
> To: users@myfaces.apache.org
> Subject: clearing input texts
> 
> 
> 
> hi all, i guess this is an easy one, but was looking around and couldn't
> find an answer. Ok, i've got this combo and these inputText fields, i
> also have an <t:commandButton type="reset">. When i choose st in the
> list my inputTexts are updating, when i push the 'reset' button is not
> doing anything. Well, actually it is doing something, it's reverting the
> inputs to their original state, that is, to the last value selected in
> the combo :). But what i want is the inputs to clear, not to reset. I
> guess i should do that with javascript, but i am not sure about how to
> access myfaces javascript components from within a funcition. Any help?
> tx in advance.
> -- 
> View this message in context:
> http://www.nabble.com/clearing-input-texts-tf3889797.html#a11026399
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> 
> * ** *** ** * ** *** ** * ** *** ** *
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed.
> Any views or opinions presented are solely those of the author, and do not
> necessarily
> represent those of ESB.
> If you have received this email in error please notify the sender.
> 
> Although ESB scans e-mail and attachments for viruses, it does not
> guarantee
> that either are virus-free and accepts no liability for any damage
> sustained
> as a result of viruses.
> 
> Company Registration Information: http://www.esb.ie/companies
> * ** *** ** * ** *** ** * ** *** ** *
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/clearing-input-texts-tf3889797.html#a11027140
Sent from the MyFaces - Users mailing list archive at Nabble.com.