[EMAIL PROTECTED] a écrit :
Hello,
here is my problem.
I have this bit of code :
<h:form id='createGroup_form'>
<h:inputText id='groupName' class="dataInputText" /><br/>
<h:commandLink type="button" value="Sauvegarder la catégorie"
action="#{groupManagerActions.saveCategory(???)}" class="button" />
</h:form >
This is in a xhtml file.
My goal is to get the value of the inputText field and pass it in the method
call just under defined in the "action" parameter of the commandLink.
In other words, how to fill the (???) to pass the value of the inputText field.
Is it possible?
Have I to use javascript to get the value and call the methode in a script?
Sorry if my question seems a bit akward.
Thanks for your help.
Hi,
The standard way to perform this kind of action with jsf is to bind the
value of the inputText field to a bean field. For instance you could have:
<h:form id="createGroup_form">
<h:inputText value="myBean.category" id="groupName"
class="dataInputText" /><br/>
<h:commandLink type="button" value="Sauvegarder la catégorie"
action="#{myBean.saveCategory}" class="button" />
</h:form>
myBean (which can be a seam component or a simple bean) should have the
following methods:
public void setCategory(String cat);
public String getCategory();
public String saveCategory();
When the form is submitted, if no error occurs, the setCategory method
is called and you can access this value in the saveCategory method
(calling the getter or accessing the field directly if you want) which
will be called after.
Regards,
--
Anahide Tchertchian, Nuxeo
Mail: [EMAIL PROTECTED] - Tel: +33 (0)1 40 33 79 87
http://www.nuxeo.com - http://www.nuxeo.org
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm