HTML onClick in Query Output

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

HTML onClick in Query Output

Post by PointsWell »

I have a BO that has to show in a Query. It relates to a line on a bank statement. I want to edit the statement line to associate it with a Contact.

I could edit the form but that seems like at least 1 step to many.
I thought about using inline editing but that won't commit until the user focus blurs from the record which is counter intuitive as the user's next step is to expand the row, which doesn't cause the focus to change necessarily.
Also using a button operation would place the button at the opposite end of the field that is relevant.

Then I thought about using

Code: Select all

<a href=”#” onclick=”AwareApp.startProcess('TEST_DELETE_MESSAGE','main')” >Show Message</a>
inside a text field to run a process to PICK ONE FROM and then insert that Contact into the statement line and replace the text field with the Contact name.

Rather than build everything I wanted to test it with the process above TEST_DELETE_MESSAGE which is just DISPLAY MESSAGE'Hello'.

The output from this is not positive:

Code: Select all

HTTP Status 404 - /AwareIM/%E2%80%9D
type Status report
message /AwareIM/%E2%80%9D
description The requested resource is not available.
Apache Tomcat/8.0.14
I have looked at all the AwareApp.function options and none of them seemed more appropriate.

Am I attempting to do something ridiculous or am I doing it wrong?
Last edited by PointsWell on Tue Mar 13, 2018 4:47 am, edited 2 times in total.
idpSteve
Posts: 201
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Re: HTML onClick in Query Output

Post by idpSteve »

Give this a try, using what you posted I got the same error..

<a href=# onclick=AwareApp.startProcess('TEST_DELETE_MESSAGE','main')>Show Message</a>

Not sure why it works without the " " but it seems to.. Let me know!
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: HTML onClick in Query Output

Post by PointsWell »

Thanks that works.
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: HTML onClick in Query Output

Post by PointsWell »

Spoke too soon.

I need awareApp2 function which passes context. Does anyone have an example of what this should look like as I haven’t managed to get the correct syntax worked out from the manual.
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: HTML onClick in Query Output

Post by customaware »

Jon,

the startProcess2 takes an instance as a parameter.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: HTML onClick in Query Output

Post by PointsWell »

Hi Mark

Not at my desk at the moment, from memory it asks for

(‘Entity’,’Identifier’,’main’)

The example uses a specific instance id but I can’t figure out the syntax to be dynamic, ie This ID
idpSteve
Posts: 201
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Re: HTML onClick in Query Output

Post by idpSteve »

So to do this I use a rule when an object is created.. An example would be:

IF Object IS NEW THEN Object.Link=`<a href=# onclick=AwareApp.startProcess2('ProcessName','Object','`+Object.ID+`','main')>Text here</a>`
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: HTML onClick in Query Output

Post by PointsWell »

idpSteve wrote:So to do this I use a rule when an object is created.. An example would be:

IF Object IS NEW THEN Object.Link=`<a href=# onclick=AwareApp.startProcess2('ProcessName','Object',`+Object.ID+`,'main')>Text here</a>`
Thanks! I was trying to make it dynamic - seems a bit clunky/inelegant to have to hardcode the ObjectID into the string.

ps for anyone other than idpSteve following this, the ObjectID has ' round it, it should just be a number like:

Code: Select all

IF Object IS NEW THEN Object.Link=`<a href=# onclick=AwareApp.startProcess2('ProcessName','Object',`+Object.ID+`,'main')>Text here</a>`
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: HTML onClick in Query Output

Post by customaware »

If I remember correctly you can just use {ID}
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
idpSteve
Posts: 201
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Re: HTML onClick in Query Output

Post by idpSteve »

Something else I've just remembered.. When you need to set multiple actions or something similar to that, like maybe you want this to be a button rather than a link and you want the button to have 2 classes, you need to separate multiple classes/actions with &#32; rather than a space because when AwareIM adds in the " " that you would normally use with a class or an action it adds before and after the first 'term'.

For example, not sure if this is applicable but I'm sure it will demonstrate the point, if you wanted an icon from font awesome that needs 2 classes:

<i class=fa&#32;fa-plus> would become <i class="fa fa-plus">
where as
<i class=fa fa-plus> would become i class="fa" fa-plus> which obviously won't work..

I can't think of exactly where I had this issue but I definitely came across it before.
Post Reply