NetTalk Central

Author Topic: Question .. Call a popup form after an autocomplete value is clicked  (Read 4404 times)

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Hi Bruce/Folks,

Right. So in order to prove to you that the enhancement of nettalk's autocomplete functionality to allow for adding records from the field itself, in order to prove this to you I need some help. From you. Ho ho.

At some point, probably the Accepted embed on the autocomplete field makes the most sense, how would you / can you call a popup form depending on the autocomplete value clicked?

IE, let's say I have a bunch of values, one of which is "Add a new one".

This is basically what I want to do:

Code: [Select]
If (p_web.GetValue('Value') = 'Add a new one') then CALL POPUP FORM .
Possible?

Cheers,

Stu
Cheers,

Stu Andrews

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Question .. Call a popup form after an autocomplete value is clicked
« Reply #1 on: June 23, 2015, 10:15:33 PM »
Would just say that if this were a question of a hyperlink or a button, then I'd just use the Nettalk procs for doing that, which work great in embed code (ie have a custom button that when clicked pulls up the form in popup mode).

But this isn't that.
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Question .. Call a popup form after an autocomplete value is clicked
« Reply #2 on: June 23, 2015, 11:03:11 PM »
Hi Stu,

>> So in order to prove to you ...

I'm not sure I need proof. What I need are a lot more fingers, or perhaps folk like yourself contributing actual code. (I understand this can be tricky, but it's well worth the effort.)

>> If (p_web.GetValue('Value') = 'Add a new one') then CALL POPUP FORM .
>> Possible?

possible yes, but it's not completely straight-forward. The underlying mechanisms that provide for popups to even exist, and then to open them, are somewhat complex. I agree that the code should look just like that, but there's a bit that has to happen under the skin to make that possible.

that said, it's probably do'able to add that infrastructure, so keep an eye on this space.

Cheers
Bruce




Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Question .. Call a popup form after an autocomplete value is clicked
« Reply #3 on: June 24, 2015, 03:40:39 PM »
Hey Bruce, I would LOVE to contribute code!

Basically, if you could just point me, maybe a tiny bit of pseudo code .. I'd love to get stuck in with jquery and embed code to get it up and running to some extent, then send you through whatever code I've got.

Stuff like:

* manually (embed code) pre-load the form on this other form, if this needs to happen anymore (I know it used to, but does it still work this way?)
* be able to know the guid/id or something from the added (if form == insert) record, to do stuff on return

Cheers,

Stu
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Question .. Call a popup form after an autocomplete value is clicked
« Reply #4 on: June 25, 2015, 06:57:38 AM »
Hi Stu,

>> * manually (embed code) pre-load the form on this other form, if this needs to happen anymore (I know it used to, but does it still work this way?)

it does.
From an "experiment" point of view you could just create a (hidden) button on the form which calls the "other form". This will alert the system that "other form" needs to be in scope here.

In the longer run a more elegant way of adding "other form" to this form is desirable (specifically for "other procedures" which are in scope, but which are called manually in embed code.)

>>  be able to know the guid/id or something from the added (if form == insert) record, to do stuff on return

There is no "return" per se. The thread that does the opening tells the "other form" to open, then ends. When "other form" closes an event is sent to the parent form (assuming popup mode here) and so you'd add code to that event handler.

To "debug" the events turn on the template switch so you can see what events arrive when.

In terms of "opening" the "other form" that's done with an ntd.push command.
(webinar starting now, I'll write more tomorrow...)


Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Question .. Call a popup form after an autocomplete value is clicked
« Reply #5 on: June 25, 2015, 02:50:36 PM »
Thanks Bruce!

Will have a crack.

Hope the webinar went well.

Stu
Cheers,

Stu Andrews