cancel
Showing results for 
Search instead for 
Did you mean: 

mandatory custom form control & disabled save button

jonesgeek
Champ in-the-making
Champ in-the-making
Hello, I am on alfresco community-4.0.a, and I am trying to create a custom form control.  The control is a drop down, and a few radio buttons and checkboxes, and a hidden input field (this is the main field which the control gets it's value from with the id from ${fieldHtmlId}).  As the user makes selections from the select box, radio buttons, and checkboxes, the value in the input is built.  I've had the input field unhidden to make sure that the value is indeed getting updated  (I am kind of modeling this off of the OOTB period control that has a hidden input that it uses for it's control value).  The problem is when I have the property as a mandatory property (defined as mandatory in the object model definition), and I try to edit a new document's properties.  As I see the value in the input field being updated, the save button is never enabled.  If I tab down the form, and tab in and tab out of the input field (without keying in any value), the save button enables itself.  I am guessing it has to do with the field with the control value never having a keystroke in it, the value is changed via javascript, but I'm doing the same thing as the OOTB period control, so mine should work, right?

Here are some things that I've tried doing (without any success):
  • change the constraint-handler in share-custom-config.xml for this field so that it fires on event="change".

  • trigger the keydown, keypress, keyup, change, and blur events on the input field after the value has changed to emulate a keystroke in the input field.
I'm out of ideas of why the save button doesn't get enabled unless I use the keyboard inside the input field, and I've spent two days looking at it, so I am now offering this up to you.  If you have any insight or other ideas to try, I would be ever greatful!

Thanks, Will
1 REPLY 1

jonesgeek
Champ in-the-making
Champ in-the-making
ok, so I found out that I was not in fact triggering the event.  I needed to call input.dispatchEvent(keyUpEvent) on the input field during onchange instead of input.onkeyup();  What threw me off was this kept firing during the input.onkeyup():
<input onkeyup="javascript:alert('onkeyup fired');" />
so I thought the event was happening.