HTML Button Error

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

HTML Button Error

Post by Stetson »

I created an HTML button which the user optionally selects to automatically initialize several fields on the form. The button calls a process which performs the field initialization. The button is throwing the following error: "Please do not modify data-ref attribute of the button and aw_custom_form_button class." The AwareIM-generated HTML associated with the button is this: "<button class="k-primary aw_custom_form_button" data-ref="<operation name="GE" type="start_process" operand="BldGrpGE" css_class="" same_panel="true"> </operation>"> GE</button>". Can someone please explain why this error is ocurring and how to correct it? Is there a better way to do this than by calling a process? Thanks very much.
PointsWell
Posts: 1473
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: HTML Button Error

Post by PointsWell »

Stetson wrote:I created an HTML button which the user optionally selects to automatically initialize several fields on the form. The button calls a process which performs the field initialization. The button is throwing the following error: "Please do not modify data-ref attribute of the button and aw_custom_form_button class." The AwareIM-generated HTML associated with the button is this: "<button class="k-primary aw_custom_form_button" data-ref="<operation name="GE" type="start_process" operand="BldGrpGE" css_class="" same_panel="true"> </operation>"> GE</button>". Can someone please explain why this error is ocurring and how to correct it? Is there a better way to do this than by calling a process? Thanks very much.
Assuming that this message is being generated during design. In which case it is not an error, it is just a warning against hand modifying the code that is produced.

Personally I think that could be handled better by putting the button code into an Aware BO and instead inserting a reference to that BO instance

The UI could ask for all the relevant info to support a button, add it to an HTMLElements Business Object and insert a tag to that HTMLElement BO in the html editing window. That would allow for the less HTML/JS savvy user to re-edit the item that has been inserted. This is an issue with html panels in VPs, google maps, etc etc
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Re: HTML Button Error

Post by Stetson »

Thanks, PointsWell. The form is an "ENTER NEW <bo>" form and I think what I'm doing is just wrong. (For example, I also get the prompt "Do you want to cancel current operation?" when I click the HTML button, even though I haven't entered any form data yet.) I'm starting clean with a better way to do this.

So again, I just want to have a button on the "ENTER NEW <bo>" form that enables the user to "preset" or default certain field values on the form if they so choose, then have the form refresh to show those values, then allow the user to proceed as normal by optionally entering additional fields, then the user would select the "Create" button to save the form data. I like your Insert idea but is that best for an "ENTER NEW" form? I don't want the "preset/default" data actually written to a table at this point, just displayed in the form fields so the user can optionally enter more data then subsequently select "Create".
Jaymer
Posts: 2528
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: HTML Button Error

Post by Jaymer »

FYI: A process that specifies a BO as INPUT will make Aware (behind the scenes) physically re-read that BO's record from the database. Its not passed "in memory". The instance ID is passed only.
So if the record doesn't exist yet (because it hasn't been saved) it cannot be read during the "resolve INPUT BOs" phase.
In the Logger, you'll see a "-1" passed as the ID - because a real ID doesn't exist yet.

So, I believe you're out of luck with that strategy.

"The button is throwing the following error" - thats not an error, its just telling you not to monkey with the tricky generated code.
Its OK to have a button there, but per my 1st stmt., you can't pass the unsaved record to another process.

IMHO, If this is important, then revise your strategy to create the record, then edit it.
Set a flag that the record is "temporary" in case the user doesn't follow thru with full creation (the Save button can call a process after save to flip a field, so you know the user really Saved the rec) so a process can clean up these unused/not-really-created records.

OR, find a way to set the values in Javascript. The button can launch a script.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Re: HTML Button Error

Post by Stetson »

Thanks, Jaymer. Good to know what my options are!
Post Reply