Phil - Thursday, December 17, 2009 3:09 PM:
Alright folks, here is the situation:
I created my own form in html (using visual studios). I then took the appropriate HTML and pasted it in ARAS as a HTML field in a new Form. (So far so good).
My question is this....I want to make it so that when the user fills out the Form in ARAS, and clicks on the "Save,Unlock, and Close" button from the toolbar, I run a method that takes the values from my HTML form and assigns them to the appropriate ItemType properties (thus saving them in the database).
My problem is : I don't know which Event to call my method on? I guess I could add an additional button on the form and then call my saving routine from the button....but I think using the existing "Save,Unlock and Close" button would be cleaner and less confusing.
I don't think I can use any server side methods because all of my HTML form fields are all client fields and thus I would not have any access to the fields on the server side.
(I tried putting runat="server" on my fields and then accessing them using standard .Net methods , i.e. this.txtTitle.Value should get me my value for my HTML field with ID: txtTitle, but this doesnt seem to work either)
PeterSchroer - Friday, December 18, 2009 9:57 AM:
Hey Phil,
Try this... slightly different approach, but let's you leverage more of the existing client code
1) all the properties that you want viewable/editable in your HTML "form in a field", also add these Properties to the Innovator Form, but using the Field Physical tab, make them In-Visible. All the user sees is your layout.
2) In your HTML, will need to something like a FormOnLoad, or use the Form Events that are built-in, and use a short piece of JS to copy the values from the hidden fields, to the visible fields in your layout.
3) In your HTML, add an OnChange event on each field, and call a new function that calls handleItemChange("poperty name","new value"); this function is built-in to the Aras tear-off window form, and this is how internally, Innovator takes the user entry out of fields, and puts it into the XML document that will be sent to the server.
The diference in approach is taking action field by field, instead of acting on the whole form (like a post) at the end of editing. In this way, your custom form behaves more like an Innovator form, and you can leverage all the exisitng infrastructure. By having the properties hidden on the form, you don't need to worry about query and store actions... the form standard logic is going to take care of moving data from the server into your form and back to server again.
Just a side note: looking at your screen shot, this is a Form that should be very easy to layout using the built in form editor. I've done forms with a hundred fields, mixed radio buttons, drop downs, big text fields, images, etc.... I think you posted previously that the form editor was not working well for you. My recommendation is to fix that problem first, and then use the built-in HTML form editor. I've taken your approach also on several occassions when I needed some some exotic layouts...
Peter.
Phil - Friday, December 18, 2009 10:32 AM:
Thank you very much for the detailed response Peter. I just want to make sure I understand one of your steps..... (step 3).
In my actual HTML code for my fields..what am I putting in for the "new value" ? Would the code look something like this?:
<input type="text" name="txtTitle" id="txtTitle" onChange="handleItemChange("title",document.getElementById("txtTitle").value)" />
I poked around in the javascripts files to try to find the function definition for handleItemChange, but I couldn't locate it...the closest I found was in the uiMethods_Ex file...but I couldn't find the definition in there.
I agree that my example form looked very simple...but even with that simple form, I could not get Innovator to play nice. Without the drag and drop working in the form generator tool, it is much faster for me to do workarounds like this.
Thanks again for your help.
PeterSchroer - Friday, December 18, 2009 10:40 AM:
Might be just a coding style change, but I would create a new function for each field, that can also be used for validation etc. In this function, call he handleItemChange()
<script>
function txtTitle_Changed() {
handleItemChange("title",document.getElementById("txtTitle").value)
}
</script>
<input type="text" name="txtTitle" id="txtTitle" onChange="txtTitle_Changed() " />
Phil - Friday, December 18, 2009 1:00 PM:
Thanks again Peter...that worked well.....however, I've found yet 1 more obstacle!
When I go to print my lovely form in Aras (By clicking the printer icon button in the toolbar), the form is brought up, but NONE of the data fields have data!!
I'm not sure why its doing that...but it's not good as I need to print out these forms!
PeterSchroer - Friday, December 18, 2009 5:57 PM:
OK - when the form is re-rendered for printing in the new window, the events that fire to populate the fields are not running.
You may want to add your own PRINT button into the form so that you can control the printig process.
My 2 cents though... i think we should resolve why the form layout tool does not work for you. Better to fix that, then to re-create so much of the standard client code.
Phil - Monday, December 21, 2009 9:52 AM:
I agree with you on the form layout tool.....however I really have no idea as to why the tool behaves so badly.
On a side note, the printing works if I right click on the form frame itself and select Print preview from the context menu. It just doesn't work if I click on the print button located on the standard toolbar. I thought about the idea of creating my own print functionality, but for the time being...is there a way to wire up a button on the form to whatever method for printing the right click print uses?
Sean - Monday, December 21, 2009 12:04 PM:
Phil,
The issue you are experiencing was addressed in the Aras Innovator 9.1.0 SP4.
This is listed in the release notes as 011974.
http://www.aras.com/support/documentation/
As a temporary workaround, you can key in the X an Y positioning on the Field Physical tab of the Form Editor.
Sean
Phil - Tuesday, December 22, 2009 4:43 PM:
I will definitely install the next version of Aras when it is released.
In the mean time, does anybody know which method I would call in order to emulate the right-click->Print Preview functionality of Aras?
Basically, I want to put a button on the form (or reprogram the print button on the toolbar) to behave just like when you right click and select print on the Form Window.