How to set hidden field value in form?

I've encountered a problem while developing a forum using JSF. See this code:
<h:form id="commmentForm" formName="commentForm" >
     <h:input_hidden id="pageId" valueRef="CommentBean.pageId" value="${article.id}"/>
     <h:input_text id="userName" valueRef="CommentBean.userName"/>
     <h:input_text id="userEmail" valueRef="CommentBean.userEmail"/>
     <h:input_text id="userURL" valueRef="CommentBean.userURL"/>
     <h:input_textarea id="content" valueRef="CommentBean.content"/>
     <h:command_button id="submit" label="Leave A Comment" commandName="submit" actionRef="CommentBean.createAction" />
</h:form>
I was trying to specify a hidden field that represents the unique ID number of the current article using <h:input_hidden> tag above. But RI complains that runtime expression is not permitted in 'value' attribute. So I set the attribute 'value' to arbitrary number such as '2', but it seems that CommentBean.pageId is still null.
So the question is:
1. Why can't I use EL in JSF tags attributes?
2. How can I resolve my problem mentioned above?
Thanks very much in advance!

To solve the problem, you have to use two hiddenfields, say:
<h:input_hidden id="pageId"valueRef="CommentBean.pageId" />
<h:input_hidden id="articleId" valueRef="article.id"/>
I want to set the value of CommentBean.pageId to
${article.id} (article is not a managed bean) and to
let CommentBean.createAction insert a database row
whose page_id column is ${article.id}, so I think the
tags you suggested won't work for me.Why can't you interrogate your ComponentBean for its pageId property during your invoke() method? By the time your invoke() method is called, the value from the hidden field will have been pushed to the model, so this should be no problem. You could do Application.getValueBinding("ComponentBean.pageId").getValue() to do so.
Ed

Similar Messages

  • How to get-set Hidden field value from JSP ?

    Hii,
    I am quite newbie about jsp and looking for some help..
    I have several url links on my jsp page.
    I when I click one of them, I want to reload my page with new request parameter(s) but also keep the older one(s) in hidden field(s)...
    but I dont know how to set and get hidden field value "syntax" and I am not sure about where/when should I do this... at first I though that I can do it in "onClick" property of url..
    Thanks..

    Hy,
    I have a problem just like that. I am trying to send the value of an subdomain is to another page to be able to modify an entry.
    So in listsubdomains.jsp I have
    <input type = "hidden" name = "subdomainid" value="<%=subdomains.SubdomainID%>"><%=subdomains[i].SubdomainID%>.
    This shouls send the id of the subdomain.
    I an sending this to modifysubdomain.jsp with <form name = "listsubdomains" method = "post" action = "modifysubdomain.jsp">
    and there I retrieve the value like this:
    Integer id = new Integer (request.getParameter("subdomainid"));
              out.println(request.getParameter("subdomainid"));
    My problem is that no matter what is the value I chose to modify it always sends the first value. If I another value manually it works, but just then.
    Please give me some ideas.

  • How to pass hidden field values on a click of a table row

    hi all,
    href = "bookAndNonBook.do"
    I am very new to struts. I have created a table using displaytable tag which displays results in a tabular format. In addtion, i have a hidden field (prodType), the table rows are getting highlighted when i get my mouse on a particular row.
    Following is the code from the results.jsp file
    <body
    onload="addRowHandlers('row', 'rowMouseOver')"
    bgcolor="#FFFFFF" text="#000000" leftmargin="100" topmargin="50"
    marginwidth="" marginheight="" rightmargin="30">
    <html:form action="/bookAndNonBook" method="post">
    <display:table name="sessionScope.productSearchList" id="row"
    sort="list" export="true" defaultsort="1" defaultorder="ascending"
    pagesize="15" decorator="org.displaytag.decorator.TotalTableDecorator"
    class="dataTable">
    <display:column property="prodType" title="ProdType" class="prodType"
    headerClass="prodType" media="html" />
    <display:column title="Title" property="titleName" sortable="true"
    class="title" headerClass="title" />
    </display:table>
    </html:form>
    </BODY>
    I am calling a funtion addRowHandlers which passes the table id (which is row) and the rowMouseover for highlighting the rows on mouse over.
    the code for function addRowHandlers is
    function addRowHandlers(tableId, rowClassName) {
    var previousClass = null;
    var table = document.getElementById(tableId);
    var rows = table.getElementsByTagName("tr");
    for (i = 1; i < rows.length; i++) {
    rows.onmouseover = function () {
    previousClass = this.className;
    this.className = this.className + " " + rowClassName ;
    this.style.cursor="hand";
    rows.onmouseout = function () {
    this.className = previousClass;
    this.style.cursor='';
    rows.onclick = function (){
    var cell = this.getElementsByTagName("td")[0];
    var ProdType = cell.innerHTML;
    alert("value of prodType = " + ProdType);
    when i run the above code and click on a particular row it returns me the value in the hidden field i.e. prodType for that particular row
    Now where i am having problem is i want that on the basis of prodType my jsp file should call different actions for different prodType as returned....somwhat a function like this
    function submitProduct(prodType) {
    if(prodType == "BK")
    resultsForm.action = "/bookProduct.do";
    else if(prodType == "NB")
    resultsForm.action = "/nonbookProduct.do";
    but i am unable to figure out that how do i this..
    Any help will be really appreciated
    Thanks
    Sam

    can you please suggest some good struts forums where i can post my question
    thanks in advance
    Sam

  • How to set default field values in customer master data.

    hi,
    I want to set default values in customer master data (account group wise).
    but
    I don't know how to set it .
    please help me.
    (I don't want to change field status in account group rather than I want to set default values for field. )
    thank you.

    hi,
    this is to inform you that,
    in SAP there is no such a provision.
    but
    in LSMW there is an option of CONSTANT VALUES.
    check in SHD0 - also
    please check and confirm
    balajis\a

  • Set Date field value through Form datasource

    Hello all,
    Has anyone set the value of a field of type Date through the form's datasource?
        If (Not Entrega = Nothing And NrDias > 0) Then
            Entrega = Entrega.AddDays(NrDias)
            ds.SetValue("U_data", ds.Offset, Entrega)
        End If
    End If
    If I change the field to a text field it write to the datasource and display no problem.
    Any ideias?
    Best regards.

    Ups,
    Found it.
    ds.setValue("U_dataent", 0, Entrega.ToString("yyyyMMdd"))

  • How to set date field in custom form to default to {NOW} plus one year.

    I am developing a subscription site. I have the custom form for inputing a users information. I have the subscribe date set up as a default field of {NOW} that works great.
    Now I need the renewal field to default to exactly one year from the subscribe date.
    Any help would definitely be appreciated.
    thanks in advance

    PHP? http://us2.php.net/manual/en/function.date-modify.php
    Alec Fehl, MCSE, A+, ACE, ACI
    Adobe Community Expert
    AUTHOR:
    Microsoft Office 2007 PowerPoint: Comprehensive Course (Labyrinth
    Publications)
    Welcome to Web Design and HTML (Labyrinth Publications)
    CO-AUTHOR:
    Microsoft Office 2007: Essentials (Labyrinth Publications)
    Computer Concepts and Vista (Labyrinth Publications)
    Mike Meyers' A+ Guide to Managing and Troubleshooting PCs (McGraw-Hill)
    Internet Systems and Applications (EMC Paradigm)

  • How to set a default value for particular field in SRM PO Portal

    Dear Gurus,
    Im desparetly need a help in web dynpro on how to set a default value for a field(flag) in PO header tab in portal.
    My requirement is whenever the user press the edit button in PO screen,automatically a flag field should be set as abap_false.
    I dont think this will handle in check badi or change badi. i tried this part in onbuttonpressed overwriteexit in CNR_VIEW views,i can get the function EDIT in debugging mode,but dont know how to proceed further.....
    Many of them suggested to go with get attribute and set attribute for changing any particular field in web dynpro,but im not very familiar in using those get and set attributes.I request you people can give me sample code on how to identify my target field in the node and set the values while pressing EDIT Button.
    Thanks in advance...
    Regards,
    Sathish

    Dear Laurent,
    Thanks for your response,
    But i searched in enhancement spot of WD_BADI, but couldnt get the exact way to change the coding,
    My real requirement is, that particular flag should be enable and disable dynamically by checking a condition in my header values.So in that case i dont know how to proceed further to handle in the PO screen.
    Kinly guide me how to get the particular node of field in the Purchase order screen.
    Thanks you in advance,
    Sorry for the inconvenience if any
    Regards,
    sathish

  • How to set a new value for formula field in crystal reports xi?

    <p>How to set a new value for formula field in crystal reports xi?</p><p>//formula</p><p>{@description}</p><p> </p><p>exemplo in VB6</p><p>crxSubreport.FormulaFields.Item(1).Text =  "&#39;Subreport Formula&#39;"  or</p><p>crxSubreport.FormulaFields.Item("description").Text =  "&#39;Subreport Formula&#39;"</p><p>How to in JRC?</p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p>

    Hi,
    This functionality is known to be very important and is a key part of the next major release of the JRC planned for the first half of 2008.
    Regards,
    <p>Blair Wheadon</p>
    <p>Product Manager, Crystal Reports</p>

  • HOW TO  SET A DEAFULT  VALUE  FOR A FIELD?

    hi friends
      i have doubt..how to  set a default  value for a field..say  like in  local printer field i always want  lp01 to  be displayed defaultly..when i  click  F1  in that  field i  get the parameter id ..i  know there is something  dealt with that  parameter id..how can i  set that  default value ..in the case of the default  printer value i made in  own data settings as lp01 but  how to  do it  normally  for other  field which has parameter id ??????
    thanks and regards
    prince

    Hi Prince,
    u can set the default value in abap as given below
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS : S_BUKRS TYPE BSID-BUKRS OBLIGATORY DEFAULT '1000'.
    PARAMETERS : S_BELNR TYPE BELNR_D OBLIGATORY DEFAULT '1600000070'.
    PARAMETERS : S_GJAHR TYPE GJAHR OBLIGATORY DEFAULT '2008'.
    PARAMETERS : ASON TYPE BUDAT OBLIGATORY DEFAULT SY-DATUM.
    PARAMETERS : S_KUNNR TYPE KUNNR MODIF ID GP1.
    PARAMETERS : S_LIFNR TYPE LIFNR MODIF ID GP2.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN : END OF BLOCK B1.
    or
    u can give the default value in INITIALIZATION also.
    vlue = '1000'.

  • How to set default date value to a field on screen

    How to set default date value to a field on screen and allow users to modify it ....

    Hello,
    In the PAI module, you need to save the changes to the database using the command MODIFY.
    Follow an example:
    Create or change a message in database table T100. If there is no message with the number 100 in the MYMSGCLASS message class in English, it will be created. Otherwise only the text is changed.
    DATA message_wa TYPE t100.
    message_wa-sprsl = 'EN'.
    message_wa-arbgb = 'MYMSGCLASS'.
    message_wa-msgnr =  '100'.
    message_wa-text =  'Some new message ...'.
    MODIFY t100 FROM message_wa.
    Regards.

  • Hidden fields in a form Dreamweaver 8

    I have a problem I can't resolve. I have with a bunch of
    hidden fields in a form. The problem I have is that some of the
    anchor points are not showing in design view for all the fields,
    just a couple show up. I have View Invisible elements in Visual
    aids turned on.
    Fields 1,2,3,9,10,11,15 don't show
    Fields 4,5,6,7,8,12,13,14 show
    Here's the code, can someone tell me what I did wrong?
    Any help will be appreciated

    Hi Max,
    This is possible in portal forms.
    The code to get the value of a field is some thing like this.
    You need to generate this javascript function using pl/sql in the Additional pl/sql Section - ... before displaying the page or ... after displaying the page.
    htp.p('
    <script>
    function myFunc(ele)
    var l_form = ele.form;
    var win;
    var val;
    var l_url = "<url>?";
    for (var i = 0; i < l_form.length ; i++){  // This is the way you traverse along all the form elements.
    if (l_form.elements.name == "<field to be refered>"){   //something like this for the field you wish to refer ==> QUESTION_RESULT.MASTER_BLOCK.QID.01
    val = l_form.elements[i].value;
    l_url = l_url+val;
    win=window.open(l_url);
    </script>
    Then call any fiels you wish to for the purpose of set or get of values.It can be even a hidden field.
    Hope this helps,contact for further clarifications.
    rahul

  • Not able to retrieve netui hidden field values in java script

    I have problem in retrieving hidden field values in javascript
    I have declared hidden field as below,
    <netui:hidden dataSource="actionForm.selectedColumns" tagId="hiddenSelectedfield"></netui:hidden>
    and retrieving with tagId in javascript as below,
    obj1 = document.getElementById(tagId).style;
    its not getting value with tagId defined in netui tag.
    Any suggestion...
    Thanks,
    Amit

    Hi,
    I'm a new bee to this adobe forms and VBS.Could you explain more on that Fdf file or Can you send some documentation where i can go through of.
    Even i'm very much happy to share the pdf file..the problem is it is binded with the SAP browser.So i cant make a copy to my local system,But i can explain all the technical stuffs inside the form.
    The form is developed using adobe lifecycle designer,i can see the fields are defined in the design view.
    The fields which i'm accessing to enter the values are visible & Set user defined values..
    when you access through the SAP portal,it opens up inside the browser ..so every field you choose or select additional fields get added based on the selection..
    The "GetField" code you have shared works perfectly fine..i could read all data,or i could select a particular field to retrieve the field.
    But the "SetField" code you have shared locating the field but it is not writing the value into the field.I called a setfocus method on the particular field as well..then put f.value = fieldvalue still it chooses the particular field but didnt feed the value...
    is it possible to call a keystroke to the particular field?
    if you have any ideas please throw it up on me..i'll try all my possibilities.
    Thanks for your time !

  • How to make a field in adobe form noneditable

    how to make a field in adobe form noneditable. like info keys..
    when this form is sent through worflow the receiver shudnt be able make changes to the field value...(I have a form, which has fields prefilled(like pernr employee name) but these fields are in editable able..(i want only some fields to be uneditable not all)
    Edited by: kumar gaurav on Apr 11, 2008 8:04 AM

    Hi,
    You can make fields non-editable at runtime using this code:
    field.access = "readOnly"
    Hope this helps.
    Amit

  • How to set a default value to t-list when creating t-list programmatically

    hi,
    I'm creating a t-list programmatically
    by calling
    n = populate_group('groupname');
    populate_list('form.list','groupname');
    In this case how to set a default value for the t-list
    thanks
    rani

    I am not sure how it works in Web Dynpro for ABAP, but in Web Dynpro for Java to set default drop down value you will have to set the value for particular attribute (which is linked to the dropdown element)  in the context
    like
    wdContext.currentContext<nodeName>Element.set<FieldName>(<defalut value>)
    This generally done in Initialization method of the controller.

  • How to set a Object value by JDI

    How to set a Object value using JDI?
    For example:
    class User{
      private String name;
      private String id;
    set and get method;
    public static void main(String[] args) throws Exception {
            VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
            List<AttachingConnector> connectors = vmm.attachingConnectors();
            SocketAttachingConnector sac = null;
            for (AttachingConnector ac : connectors) {
                if (ac instanceof SocketAttachingConnector) {
                    sac = (SocketAttachingConnector) ac;
                    break;
            if (sac == null) {
                System.out.println("JDI error");
                return;
            Map<String, Connector.Argument> arguments = sac.defaultArguments();
            Connector.Argument hostArg = arguments.get("hostname");
            Connector.Argument portArg = arguments.get("port");
            hostArg.setValue(HOST);
            portArg.setValue(String.valueOf(PORT));
            vmMachine = sac.attach(arguments);
            List<ReferenceType> classesByName = vmMachine.classesByName(CLSNAME);
            if (classesByName == null || classesByName.size() == 0) {
                System.out.println("No class found");
                return;
            ReferenceType rt = classesByName.get(0);
            List<Method> methodsByName = rt.methodsByName(METHODNAME);
            if (methodsByName == null || methodsByName.size() == 0) {
                System.out.println("No method found");
                return;
            Method method = methodsByName.get(0);
    I will connect to server and monitor the remote server JVM , There is a object of User, I want to change its value by the Java Debugger Interface by client.
    so how to set its value by the client, and I can not got the User bean at client.
    I know the basic type filed value changed as follows:
    Value newValue = vmMachine.mirrorOf("change var value");// this field is a string.
    stackFrame.thisObject().setValue(field, newValue);
    But a Object , how can I change its value.
    Thanks Advanced.

    ObjectReference.setValue() is the method for chaining the value of an Object's field. First you need to find the specific Object you want to change, though.
    /Staffan

Maybe you are looking for