Submit button being disabled if no changes are made to the editable grid

Under the grid, display a SAVE button. The button should be disabled by default.
If any changes are made to the grid (i.e. if a row is added, a row is removed, or data entered for a row is changed), the button should be enabled. After the button is clicked, it should become disabled again. Any help will be appreciated.

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    in reply to RAHUL GANJI

    I'm unclear what's still not working for you - could you attach some screenshots and/or sample code?  (please use the Insert Code box to preserve formatting and not blow up the post)

  • Can you clarify a few things?

    1) You have two buttons (at least), one to allow uses to add a new file, and one that allows users to save changes to the editable items in your grid.  

    2) The attach file button should be disabled when a user is editing data in the grid, but the "save" button should be enabled if there are changes?

    3) You have a complete expression rule that that generates a single row (you are not, for example, calling gridRowLayout() in an a!foreach(), but are calling your own custom crafted expression that generates each row)?

    If the above are true, you could use a single variable (as in the examples people have provided) to generate enabled state/disabled state.  Or you could use two variables if they may act independently.

    What you will likely have to do  do, is pass the variable(s) controlling those states into the expression that generates the rows, so you can update it in the fields that should enable the save button and disable the attach button.

    If you have a more complete case to share, we can probably help you further (maybe supply a code example)?

  • Yeah I got it with passing the boolean variable to make the button disabled from expression rule to interface

    Thank you

  • Here in the above example if the user wants to change something in the status(editable) and just again changed his mind and let it be as it is clicking backspace then I dont want to enable the save button as there is no change in the data..Is there anyway you can help me out please

  • 0
    Certified Lead Developer
    in reply to RAHUL GANJI

    a!textField automatically performs its saveInto when the field is unfocused (i.e. the user clicks or tabs away); the WITH() variable won't update until after that.  In general, it updates fast enough that the user can't get to the button in time even if they change something and try clicking right away.  However if you need it to be even tighter in timing, you can add 'refreshafter: "KEYPRESS"' to the a!textField which will cause the saveInto to be immediately executed every time the user changes something.  This has performance implications if you use it too much or in too many fields in a form, but with limited usage it works fine.  If I understand your scenario correctly, this is probably the solution you're looking for.

  • No I dont want the button to be enabled if the user doesnot actually makes changes to the editable field and also how can I check with the documents being duplicated...dont want to upload a new document if it already exists

  • 0
    Certified Lead Developer
    in reply to RAHUL GANJI
    No I dont want the button to be enabled if the user doesnot actually makes changes

    the code I've suggested handles this.

    and also how can I check with the documents being duplicated...dont want to upload a new document if it already exists

    Appian treats all uploaded files as unique IDs - it has no direct way of knowing whether two different files are identical, though you could add a validation to your upload which checks whether the uploaded file name and size (for example) are identical to a previously uploaded file.

  • Mike ,

    I have a relation action shortcut on a record summary 

    When I perform "Delete Record" related action ,the record successfully gets deleted through a process model without activity chaining but after deletion it returns back to the Summary dashboard instead of the Record grid view...How can I handle this? 

  • 0
    Certified Lead Developer
    in reply to RAHUL GANJI

    There's no easy way to do this that I know of.  One of the only suggestions I have might be, after the deletion is completed, have the user chain forward into a user input task that has no Submit button - and on that task, show a record link with the record type set but no record identifier - i believe this will cause them to be linked to the record listing when they click it.  (The task would need to time out after a few minutes to end the process in the background.)  The text for the link could say something like, "Click here to return to Record Listing", along with some explanation that the record has now been deleted and to not try clicking back to "summary" etc.