Jsf+javascript for form button enable/disable

I have a page that has checkboxes and input boxes on it. I want the submit button disable when the page initially loads, and then upon making any chages to the form fields, enable the submit button. I have the javascript working, but the form is actually not going to my submit method in my backing bean. Here is my javascript:
function enableSubmitButton(form, inputElement) {
    var formId = document.getElementById(inputElement.id).form.id;
    var submitButtonId = document[formId][formId+":submitButton"];
    submitButtonId.disabled = false;
    submitButtonId.setAttribute("class", "inputButton");
    submitButtonId.setAttribute("className", "inputButton"); // for IE which does not recognize "class"
}Here is an example of a checkbox:
<h:selectBooleanCheckbox id="chkChannelEmail"
     value="#{services.emailSubscribed}"
     rendered="#{services.renderEmail}"
     onclick="displayRequiredFields(this, 'chkChannelService); enableSubmitButton(this.form, this);">
</h:selectBooleanCheckbox>and here is my command button
<h:commandButton type="submit" value="Submit" id="submitButton" action="#{BackingBean.submit}" styleClass="inputButtonDisabled" disabled="true" />It seems to be updating the disabled value, because when my page loads up, i can alert out the disabled value, and it is true, and if I click on a checkbox, it alerts out that the disabled value is false, but submitting my page doesn't actually work.
Thanks!!
Edited by: jrthor2 on Oct 16, 2009 3:10 PM

The commandbutton won't be invoked as long as the disabled attribute still evaluates to 'true' in the server side. So you need to solve this the other way. Let the disabled attribute for example depend on a request parameter or pass a hidden input element which notifies JSF that the disabled attribute should evaluate to 'false' and so on.
The same story applies on the 'rendered' attribute by the way.

Similar Messages

  • Adobe Acrobat X Pro - Javascript for submit button

    Hi,
    I am new to Adobe Acrobat X Pro and I have just designed a fillable form and enabled user rights for reader, for them to send the form back as a PDF. I created the form with a submit button and have mailto:[email protected] but I want to know if it is possible to create a button that will run a javascript to bring up a persons Mircosoft Outlook contacts, so they can choose who they want to send the completed form too.
    Any help would be greatly appreciated.
    Thanks.

    See post #7 and #10 in the following topic: http://forums.adobe.com/thread/793083?tstart=0

  • Button enable/disable in Master-Detail table

    I am using JDeveloper 11.1.1.3.0 and I have a page fragment (.jsff) which includes a Master-Detail table and the Master table has 3 buttons that get enabled/disabled based on the specific string within a column say, if the column has value, 'DRAFT', the buttons should be enabled. In all other cases, the buttons should be disabled.
    The above mentioned scenario works in cases where the table has more than one row in the table; but in two cases the buttons don't get enabled even though the column has 'DRAFT' as its value:
         1. when the table first loads with the data populated in the table; clicking on the first row doesn't trigger the buttons, clicking on any other row triggers the buttons
         2. when there is only one row in the table
    To resolve this, I tried looking at the logs for any specific information regarding the buttons getting enabled or disabled. I couldn't find info on setting up a breakpoint for the commandbutton and the disabled property which would enable me to determine whether it is being triggered as soon as the table gets populated or not.
    How can I get the buttons to work per my requirements? Also, can I set breakpoints for the button and/or evaluate disabled property's EL expression?
    Thanks in advance.

    Navaneeth:
    The buttons are part of panelCollection which exists in panelHeader. As the below code demonstrates,
    1. Buttons are defined in the toolbar (t2) in panelCollection (pc1)
    2. Each buttons' partialTrigger is set to the table (md1)
    3. Tables' (md1) partialTrigger is set to the toolbar (t2).
    <af:panelHeader text="#{viewcontrollerBundle.HISTORIC_PANEL_SPECS__TESTER_S}" id="ph2">
            <af:panelCollection id="pc1" styleClass="AFStretchWidth">
              <f:facet name="menus"/>
              <f:facet name="toolbar">
                <af:toolbar id="t2" partialTriggers="t2">
                  <af:commandButton actionListener="#{bindings.promotePanelSpec.execute}"
                                    text="#{viewcontrollerBundle.PROMOTE_PANEL_SPEC}"
                                    id="cb1" icon="/Images/up16.png"
                                    partialTriggers="md1"
                                    disabled='#{bindings.Status!="DRAFT"}'
                                    immediate="true"/>
                  <af:commandButton text="#{viewcontrollerBundle.ADD_TESTER_SPEC}" id="cb2"
                                    partialTriggers="md1"
                                    icon="/Images/action_add.gif"
                                    actionListener="#{bindings.CreateWithParams.execute}"
                                    action="addTestSpec"
                                    disabled='#{bindings.Status!="DRAFT"}'/>
                  <af:commandButton actionListener="#{PanelSpecTesterSpec.deleteTesterSpec}"
                                    text="#{viewcontrollerBundle.REMOVE_TESTER_SPEC}"
                                    id="cb3" partialTriggers="md1 ::pc2:t1"
                                    icon="/Images/delete.png"
                                    disabled='#{bindings.Status!="DRAFT"}'/>
                </af:toolbar>
              </f:facet>
              <f:facet name="statusbar"/>
              <af:table id="md1"
                        rows="#{bindings.PanelSpecTesterSpecView1.rangeSize}"
                        fetchSize="#{bindings.PanelSpecTesterSpecView1.rangeSize}"
                        emptyText="#{bindings.PanelSpecTesterSpecView1.viewable ? 'No data to display.' : 'Access Denied.'}"
                        var="row"
                        value="#{bindings.PanelSpecTesterSpecView1.collectionModel}"
                        rowBandingInterval="0"
                        selectedRowKeys="#{bindings.PanelSpecTesterSpecView1.collectionModel.selectedRow}"
                        selectionListener="#{bindings.PanelSpecTesterSpecView1.collectionModel.makeCurrent}"
                        rowSelection="single" partialTriggers="::t2"
                        filterVisible="true" displayRow="selected"
                        filterModel="#{bindings.ProductIdPanelSpecVersionToolNameQuery.queryDescriptor}"
                        queryListener="#{bindings.ProductIdPanelSpecVersionToolNameQuery.processQuery}">
                <af:column headerText="#{bindings.PanelSpecTesterSpecView1.hints.ProductId.label}"
                           sortProperty="ProductId" sortable="true" id="c39"
                           filterable="true">
                  <af:outputText value="#{row.ProductId}" id="ot28"/>
                </af:column>
                <af:column headerText="#{bindings.PanelSpecTesterSpecView1.hints.Status.label}"
                           sortProperty="Status" sortable="true" id="c43"
                           filterable="true">
                  <af:outputText value="#{row.Status}" id="ot40"/>
                </af:column>
              </af:table>
         </af:panelCollection>
    </af:panelHeader>The fact that the above code works when there are multiple rows tells me that buttons are having trouble reading the first row of the table.
    Also, I changed the displayRow property for the table from "selected" to "first" but no luck either.

  • Button Enabled/Disabled linked to FormMode?

    Hi,
    I am new to SBO SDK and am in a learning as I go process having done basic training.
    I am adding a button to the business partners page.
    The new button I need 'greyed out' "oForm.Items.Item("oBtn1").Enabled = False" when the form mode is add or find and Enabled otherwise.
    I have tried linking to another button that follows such logic as essentially the conditional is processed anyway and alternatively I have tried as below by interrogating the current form type.
    Private Sub oApp_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles oApp.ItemEvent
            Try
                If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD And pVal.FormType = 134 And pVal.Before_Action = True Then
                    Dim oItem As SAPbouiCOM.Item
                    Dim oForm As SAPbouiCOM.Form
                    Dim oButton As SAPbouiCOM.Button
                    oForm = oApp.Forms.GetForm(134, 0)
                    oItem = oForm.Items.Add("oBtn1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
                    oItem.Top = oForm.Items.Item(1).Top
                    oItem.Left = oForm.Items.Item(1).Left + oForm.Items.Item(1).Width + 65
                    oItem.Width = oForm.Items.Item(1).Width + 10
                    oItem.Height = oForm.Items.Item(1).Height
                    oButton = oItem.Specific
                    oButton.Caption = "Discounts"
                    If pVal.FormMode = SAPbouiCOM.BoAutoFormMode.afm_Add Or pVal.FormMode = SAPbouiCOM.BoAutoFormMode.afm_Find Then
                      oApp.MessageBox("add mode")
                      oForm.Items.Item("oBtn1").Enabled = False
                    ElseIf pVal.FormMode = SAPbouiCOM.BoAutoFormMode.afm_Find Then
                      oApp.MessageBox("find mode")
                      oForm.Items.Item("oBtn1").Enabled = False
                    ElseIf pVal.FormMode = SAPbouiCOM.BoAutoFormMode.afm_Ok Then
                       oApp.MessageBox("ok mode")
                       oForm.Items.Item("oBtn1").Enabled = True
                    ElseIf pVal.FormMode = SAPbouiCOM.BoAutoFormMode.afm_View Then
                      oApp.MessageBox("view mode")
                      oForm.Items.Item("oBtn1").Enabled = True
                    End If
                End If.....
    What s the best method, and also how can it be updated if the form changes from add mode to ok mode for example as this only executes on form load.
    Any help greatly appreciated.
    Dave A.
    Edited by: David Alexander on Jul 22, 2008 3:23 PM

    Welcome on Board !
    I am suggesting to Use the Automanaged property. See more information in the help ! It happens sometimes (orange arrow) links that forms working strange.
    '... from your code...
    oForm.Items.Item("oBtn1").SetAutoManagedAttribute( [AttrType],[ModeMask],[Behavior])
    Where 
    AttrType
    ama_Visible  - Selects the visible item attribute. 
    ama_Editable -  Selects the editable item attribute. 
    ModeMask
    afm_All -1 Specifies all modes are available to your form.
    afm_Ok 1 Specifies OK mode is available to your form.
    afm_Add 2 Specifies Add mode is available to your form.
    afm_Find 4 Specifies Find mode is available to your form.
    afm_View 8 Specifies View mode is available to your form.
    Behavior
    mvb_False - The setting in AttrType parameter is false. 
    mvb_True - The setting in AttrType parameter is true. 
    mvb_Default - The item attribute behaves according to the attribute default in the specified form mode. 
    Regards,
    J.

  • EE App - Event Listener for Deploy, Undeploy, Enable, Disable?

    Is there any way to create a listener that will get application (rather than bean) life cycle events - especially deploy, undeploy, enable and disable?

    Andreas,
    The directory really exists.
    I guess the problem is in the inconsistence between configurations, but how can I be sure of that? Any special procedure?

  • Button enabled

    Hi all,
    I have to make at run time enabled or not a button... I have created an attribute in my context, the type is WDY_WB_PROPERTY_BUTTON and I have associated my button at this attribute, so in the method "WDDOINIT" I write this code:
    IF flag IS INITIAL.
        button-ENABLED = ' '.
      ELSE.
        button-ENABLED = 'X'.
      ENDIF.
      wd_context->set_attribute(
         name =  'BUTTON'
         value =  button ).
    ENDIF.
    but I don't see never my button, although flag =  'X'.... How can I do?

    bind the VALUE propery of ur button with context attribute of type WDY_BOOLEAN
    For making button enable/disable , we have to bind Enable property of button with an attribute of type wdy_boolean.
    There is no property of button by name value.

  • Enable/disable/defaulting the radio button in tabular Form

    Hi friends,
    I have one radio button column in my tabular form with 3 values for it.
    <li>FC
    <li>BC
    <li>EC
    I need to enable/disable the radio buttons according to the position of the user.
    If the position of the user is CEO means,
    then FC radio button has to be checked defaultly and also for him he needs to have BC and EC radio buttons to be enabled.
    If the position of the user is between(1-4) grades means,
    then FC radio button has to be disabled, but BC radio button has to be checked defaultly and also for him he needs to have EC radio buttons to be enabled.
    If the position of the user is between(4-6) grades means,
    then FC, BC radio button has to be disabled, but EC radio button has to be checked defaultly.
    How i can achieve this radio button enabling/disabling and defaulting it dynamically according to the user.
    Where i need to specify this kind of restriction inorder to work for me in my application.
    Brgds,
    Mini

    Hi Bob,
    thanks for your reply first, and your suggestion too.
    I tried in the below manner on the lov definition of my radio button and it hide/shown according to the user who logs into the application.
    SELECT 'FC' d, 'FC' r FROM DUAL WHERE lower(:APP_USER) = (select lower(user_name) from apps.xxhy_ams_details_v where upper(job_name) = 'CEO')
    UNION ALL
    SELECT 'BC' d, 'BC' r FROM DUAL WHERE lower(:APP_USER) IN (select lower(user_name) from apps.xxhy_ams_details_v where grade_name
    BETWEEN 1 and 4 OR lower(:APP_USER) = (select lower(user_name) from apps.xxhy_ams_details_v where upper(job_name) = 'CEO'))
    UNION ALL
    SELECT 'EC' d, 'EC' r FROM DUALBut how i can check the radio button defaultly according to the user who logs in .
    <li> If the employee with the position CEO logs into the application means, he needs to have FC to be checked defaultly.
    <li> If the employee with the grade between(1-4) logs into the application means, he needs to have BC to be checked defaultly.
    <li> If the employee with the grade between(5-12) logs into the application means, he needs to have EC to be checked defaultly.
    Note:
    Instead of hide/show the radio buttons defaultly whether it is possible to enable/disable the radio button according to the user who logs into the application.
    Brgds,
    Mini...

  • Enable/disable fields in Workspace form

    Okay here is my scenario. I need to disable some fields on a form depending on which user logs onto workspace to open the same form.
    1. User1 logs onto workspace and opens leave request form, fields at the top of the form are enabled for the user to fill out, bottom fields which are for leave request administrator to fill out are disabled but visible.
    2. User1 fills out top portion of leave request form and completes form. Workflow sends form to leave request administrators "To do" list in Workspace.
    3. Administrator opens up submitted form in Workspace and sees User1's filled out data on the form and the bottom fields are now enabled for administrator to approve or dissaprove. Bottom fields only include two check boxes, two text fields and one date field.
    Now how is this done? I am sure their maybe scripting involved? if so what is it and at what events in the form? Is this whole process done in the form or through Admin UI or Workebench as well? Please help!!!!!!!!!

    Hi Rahat,
    You can use the same form and enable/disable some fields according to the user's role with only little scripting. Review the steps the below:
    1-First place a hidden field ("user_role") in your form
    2-Insert a script object into your form onder "Variables" in object hierarchy and write a script for enabling/disabling the fields (regarding the value of "user_role")
    3-On the initialize and change events of the "user_role" call your script object
    4-On your process design, put a SetValue service before User tasks. In the asssignment you should set the desired user_role to the form, so that the script is triggered in your form and the fields are enabled/desiabled
    Fro further needs on your form or process design you can contact us from: http://www.kgc.com.tr/company_Contact.html
    Oguz
    http://www.kgc.com.tr

  • OIM ICF Connector Framework - Enable Disable Method

    Hi ,
    I am currently working on developing custom OIM connector using ICF Framework , I am trying to create an adapter for application user enable disable . I am not sure about which method gets called to disable the user .
    Do I need to write a seperate disableUser Method in the connector code , currently have methods for Create , Update and delete , do I need to write 2 more methods for Enable Disable of users.
    I belive th UpdateOP interface is called during the disable / enable process .
    any help would be much appreciated.
    Cheers
    Easwaran

    I'm getting the same error when it runs update user to add child values:
    Thread Id: 125     Time: 2013-02-22 09:24:53.204     Class: org.identityconnectors.framework.api.operations.UpdateApiOp     Method: update     Level: OK     Message: Exception:
    java.lang.NullPointerException: Parameter 'uid' must not be null.
    This is the attribute map that get's passed in. unixids are the child values.
    Thread Id: 125     Time: 2013-02-22 09:24:53.202     Class: org.identityconnectors.framework.api.operations.UpdateApiOp     Method: update     Level: OK     Message: Enter: update(ObjectClass: __ACCOUNT__, null, [Attribute: {Name=unixuids, Value=[sdfasdfasd]}], null)
    Here is my what my schema looks like for if it helps:
    <ObjectClassInfos>
    <ObjectClassInfo type='__ACCOUNT__' container='false' embedded='false'>
    <AttributeInfos>
    <AttributeInfo name='unixuids' type='String'>
    <AttributeInfoFlag value='MULTIVALUED'/>
    </AttributeInfo>
    <AttributeInfo name='__NAME__' type='String'>
    <AttributeInfoFlag value='REQUIRED'/>
    <AttributeInfoFlag value='NOT_UPDATEABLE'/>
    </AttributeInfo>
    </AttributeInfos>
    </ObjectClassInfo>
    </ObjectClassInfos>
    How did you fix your problem?
    Edited by: DJ on Feb 22, 2013 9:58 AM

  • Screen Personas 2.0 Enable/Disable script button in Javascript

    Hi,
    Has anyone tried enabling or disabling script buttons on a flavor using Javascript. I have two script buttons,
    The first one (Button1) searches for a contract based on the contract id provided by the user in a text box. (So, the script triggers the transaction me33k, fetches and displays the relevant fields in the flavor)
    Now, based on whether the contract is present in the system the user needs to click another script button (Button2) which will allow him to create an order. Currently the button is disabled (ScriptButton.IsEnabled = false in the Properties menu).
    In the Button1 script towards the end, I need to enable Button2 is a contract is found. So in the Button1 script, at the final step I try to calculate in JS and write the following JS code,
    var args.btn2id = document.getElementById("Personas/blahblahblah");
    args.btn2id.disabled = false;
    But this is never works. And I have noticed that the control id does not return the control object in Javascript (so, args.btn2id is always null) and I tried removing the '/' and various other options.
    Has anyone ever tried to enable/disable buttons in Personas? Is it even possible?
    Abhijeet

    You don't have access to the Personas control properties from JavaScript to dynamically change them.
    About the only thing that comes to mind is Tobias' method to hide the script button if you want to disable it.

  • How can I control the enable/disable of command buttons in ADF JSF

    I have been having a great deal of trouble trying to work out how to control the command button such that if the rowset is null then the button is disabled. The trick is that the rowset is not defined by the view where the command button is located. The rowset is defined by a view which has a "view" command button which displays the specific row selected, then this view has a command button that will display the detail rowset of the selected master row, but if there are no detail records I want the button to be disabled. How can I do this in ADF JSF? If I use a backing bean to make the determination prior to the page rendering then how does the backing mean method set the parameter necessary to disable the command button? Any advice or tutorial that I can use is most appreciated. My goal with using ADF JSF effort was to demonstrate that a complex app could be generated with minimum coding, I would like to keep to this concept if possible. Thanks,
    Michael

    Hi Michael,
    You can probably set the Enabled property of the command button using an EL that would evaluate and return true or false based on your requirement.
    Check out these links for more information on using the EL.
    http://radio.weblogs.com/0118231/2006/11/10.html
    http://database.in2p3.fr/doc/oracle/Oracle_Application_Server_10_Release_3/web.1013/b25947/web_dcp006.htm
    -Arun

  • PDF Form javascript for making readonly field by using button

    Please let me know the PDF Form JavaScript for making selected fields(Text field,Drop down list,..) as read-only by using Button.

    Do you want your button to be made read only?
    One starts with Acrobat JS Reference.
    // make all fields in a form read only;
    var oField; // variable for field being processed;
    // loop through the form fields;
    for (var i = 0; i < this.numFields; i++) {
    // process each field name;
    oField = this.getField(this.getNthFieldName(i)).readonly = true;

  • Why can't we simply have an option to enable/disable Javascript on sites again in the settings for Firefox 27? Suddenly my Gmail attachments won't open. Gmail.

    Suddenly my Gmail attachments have stopped opening, and I receive the message: JavaScript must be enabled in order for you to use Gmail in standard view. However, it seems JavaScript is either disabled or not supported by your browser. To use standard view, enable JavaScript by changing your browser options, then try again.
    I found a Mozilla support thread where it was explained that Javascript has been turned off for a while in FF. OK. Then there was a complicated answer about how you could still turn it back on by typing in a config code into the address bar. What? Or, you could download an extension to do that for you. Why?
    Please-- if you really feel like users can't be trusted, and Javascript must be turned off, at least bring back the ability to enable/disable Javascript on a per site basis in options, without having to know code. It's Gmail.
    Thank you.

    There is nothing on that thread that says Javascript is turned off by default. to quote:
    "In Firefox 23, as part of an effort to simplify the Firefox options set and protect users from unintentially damaging their Firefox, the option to disable JavaScript was removed from the Firefox Options window.
    However, the option to disable JavaScript was not removed from Firefox entirely. You can still access it from about:config or by installing an add-on. "
    The UI checkbox to disable Javascript was removed, but the option still exists in about:config (which isn't code btw, it's just preferences), nor was Javascript turned off by default, in fact the opposite is true, it is enabled by default with the option to disable it made a little more difficult to find, as only advanced users need to disable Javascript.
    Please try to clear the cache and cookies for gmail, let's see if those are causing problems. [[Delete cookies to remove the information websites have stored on your computer]], [[How to clear the Firefox cache]]

  • Enable/disable lov button in a multi-row bloc

    Hi all,
    I have a form in which there is a multi-row block with some lov buttons related to some items,
    in query mode, user should not be able to modify item, item property update_allowed is set to false, that worked, but user is able to modify item when he clicks on the lov button...so i want to disable the button for query records and for record in (insert or new), button should be enable,
    i tried some tips but don't work, do you have any idea
    Thanks for your help.

    Hi,
    Can you suggest some methods to enable/disable LOVs in my search query? I have a customized VC which performs search and I need to enable/disable the LOVs depending on requirement.
    Abhishek

  • Enabling/Disabling a button in Web appl. based on exception in a Query

    Hi all,
    I am wondering whether we can grey out a button in the web applic. designer based on whether a report has an exception showing.
    So now we can enable or disable a button, so at runtime, when the web app runs, and a condition is visible in the analysis item table, then the button (save for example) should be disabled, otherwise if there are no exceptions then it should be enabled.
    I am thinking Javascript, but not sure how to read the exceptions in a web apps query?
    Thanks for any help forwarded.
    Regards
    SMS

    Hi Sumit,
    just add one more attribute of type wdy_boolean, and bind this attribute to readonly property of button by coding.
    then as per your cell value set the attribute value, below is the some sample code.
    METHOD wddoinit .
      DATA: lv_node TYPE REF TO if_wd_context_node,
            lt_mara TYPE ig_componentcontroller=>elements_mara,
            wa_mara TYPE ig_componentcontroller=>element_mara.
      SELECT matnr
             ersda
             ernam
             mtart
             matkl
             meins FROM mara INTO CORRESPONDING FIELDS OF TABLE lt_mara
                                     WHERE meins = 'GM' OR meins = 'CCM'.
      SORT lt_mara BY meins.
      lv_node = wd_context->get_child_node( name = wd_this->wdctx_mara ).
      LOOP AT lt_mara INTO wa_mara.
        IF wa_mara-meins = 'GM'.
          wa_mara-readonly = 'X'.
        ELSE.
          wa_mara-readonly = ' '.
        ENDIF.
        MODIFY lt_mara FROM wa_mara TRANSPORTING readonly.
        lv_node->bind_structure(  SET_INITIAL_ELEMENTS = ABAP_FALSE
                                  new_item = wa_mara ).
      ENDLOOP.
      lv_node->bind_table( new_items = lt_mara ).
    ENDMETHOD.
    Regards
    Srinivas

Maybe you are looking for