Referencing input parameter inside Table Records, with javascript

Referencing input parameter inside Table Records, with javascript

  
Hello,
im having a bit of a problem going around this one, and its safe to say i have tried everything. This is not easy to explain though...

What i am trying to achieve is table listing of some fields, each row with input text boxes for the user to fill, simple enough. To achieve this I used the table records widget and on the right colum simply added the text box. Originaly the box and the rest was suposed to be inside a webblock but, i scaled it down to make it as simples as i could.

So the plan would be to fill in those fields, press a button and the list would be updated. I actualy managed to do that, using a webblock with the fields, retrieving the values inserted with the "on Notify" property, and assigning them to a list with the list.CurrentRowNumber. This was not this simple but, it worked.
The problem was when i inserted javascript in the middle. My goal was to get a popup window when clicking on the text boxes, give input to the popup window, and retrieve that input along with the CurrentRowNumber and update the list with the Ajax Refresh.

The problem is that it seems that once i run JavaScript i lose track of the current row, and it just becomes the last value of the list. Not being ablo to get that, i cant update the correct value to the list. Hope this wasnt too confusing...

I have tried everything i can think of (trust me). So i am seeking some enlightment if anyone has the time for it.


Thank you once again,
Rui Molefas
Hi Rui,

Can you give a OML with a little example of your problem?
Best Regards,
Hélder Araújo






Hi Rui,

From what I understood you want to: click on a text field which opens a popup, in this popup you insert a value and then when you save/close the popup you need the currentRowNumber you fired that popup from, is this it?

You can do it all without the need for javascript code (except the one the platform will generate for you!).
1 - Create an input parameter in you popup to receive the rowNumber
2 - do all the stuff you want in the popup
3 - when the users saves what he wants you pass the rowNumber you need in the "argument" property of the "Popup_Editor_Notify" action.
4 - Then you catch this "argument" in your screen with your popup's "onNotify" action using the "NotifyWidgetGetMessage" and converting it from text to an integer.

does this help you?

Cheers,
Hermínio Mira
Hi Hermínio,
thanks for the reply.

I forgot to mention that this is a mobile application. I worked with the popup before and it would be perfect indeed, not the case though.

Helder: I will try to get one example ready and post it here as soon as i can. Thank you!
Hello all,
i am sorry to have taken so long to reply but i have been out.

I made a very simple example of my problem. What i am actualy trying to achieve is a bit more complicated but, this is where i am now.

The objective of this .oml is to show how i am trying to interact with certain values inside a generated javascript popup, but im not being able to pass them onto that popup.
Given a RecordList, i am trying to interact with each element of that list, by generating a popup in wich its content depends on the Record being acessed.

This was the simpliest example i could create.

Thank you,
Rui Molefas
Hi Rui,

The problem with your sample is that the content of the webblock is replicated multiple times in the page.
So even tho $('.popupContact') is a nice way to find your divs in javascript, you will have multiple of them in your page (one per line).

So start by removing that unexcaped expression completly and put it the block javascript (so it gets loaded only once to the browser)
Then create only one method there that takes as parameter the id of the div you want to popup.

Like:

function loadPopup(divId) {
    //loads popup only if it is disabled
    if(popupStatus==0){
        $('#backgroundPopup').css({
            'opacity': '0.7'
        });
        centerPopup(divId);
        $('#backgroundPopup').fadeIn('slow');
        $('#' + divId).fadeIn('fast');
        popupStatus = 1;
    }
}

(Note that I also pushed the center code to inside the popup method and passed the Id)

Then remove the on click code completly from your javascript.
Instead go to your button (actually on you final application I suggest a Div, or a Table Row. expecially for device applications looks nice instead of buttons)
and add a Extended Property onclick with  "loadPopup('" + popupContact.Id + "'); return false;"

Regards,
João Rosado
Thank you João,
i realized my problem had to do with the replication of the webblock, just didnt know how to go around it.
I will definitly try that approach, plus its a lot simpler.

Thanks a lot,
Rui Molefas
Hi again,
this approach worked wonders! I was definitly stuck there.

Thanks a lot,
Rui Molefas