Focal Point
[Closed] JavaScript and Maintain - Passing Arguments

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8027083016

September 28, 2011, 04:01 PM
amworld
[Closed] JavaScript and Maintain - Passing Arguments
Hi,

This is what I want to achieve -

Display a list of records in a Maintain form. The first column would be the radio button.

On clicking of the radio button, a Javascript function would be triggered. This function would iterate through all the radio buttons, and select the one which is marked. It would then call an MAINTAIN argument UpdateForm which takes a parameter ID. It would set the Stack and show Maintain update form.

Somehow I can't seem to get it work. Any examples?

This message has been edited. Last edited by: amworld,


WebFOCUS 7.6
Windows, All Outputs
September 29, 2011, 11:07 AM
Maintain Wizard
When you say you want to display a list of records with a radio button in the first column, are you trying to use an HTML Table? If so, when you compute the radio button into column one, add an OnClck event into the compute. That event can reset all of the radio buttons on the form.

I don't understand what you want to do from there.

Mark
September 30, 2011, 03:49 AM
Alan B
I agree with Mark.

However using an HTML Table gives you the ability for a ClickLink event plus ClickRow to determine which row was selected. I would not use radio buttons as they are not really effective in this case.


Alan.
WF 7.705/8.007
September 30, 2011, 03:10 PM
amworld
quote:
Originally posted by Maintain Wizard:
When you say you want to display a list of records with a radio button in the first column, are you trying to use an HTML Table? If so, when you compute the radio button into column one, add an OnClck event into the compute. That event can reset all of the radio buttons on the form.

I don't understand what you want to do from there.

Mark


Hi,

Thanks for the response. A row in the HTML table can have 3 actions - Edit/View/Run. So the user selects a radio button, say row 3, and then clicks on either of the three buttons to move to next screen.


WebFOCUS 7.6
Windows, All Outputs
October 01, 2011, 06:28 AM
Alan B
OK

With the HTML Table add columns for the radio buttons. For each radio button row make sure that the content type is HTML and the Link is body only.

Add an event handler for the table using type ClickLink. On this event perform a case (doWork) within the maintain. Use code like:
MAINTAIN file car

Case Top

countryStack.radio1/a0;
countryStack.radio2/a0;
countryStack.radio3/a0;


for all next country into countryStack;

repeat countryStack.FocCount i/14 = 1;
countryStack(i).radio1 = '<input type="radio" name="radio1" value="edit" />';
countryStack(i).radio2 = '<input type="radio" name="radio2" value="view" />';
countryStack(i).radio3 = '<input type="radio" name="radio3" value="run" />';

endrepeat i = i + 1;

Winform Show carForm; 

EndCase

Case doWork
row/i4 = carForm.HTMLTable.ClickRow;
col/i4 = carForm.HTMLTable.ClickColumn;

type "<row";
type "<col";

EndCase

END

which will tell you which row in the stack was clicked, and the column will determine which action to take.


Alan.
WF 7.705/8.007
October 01, 2011, 11:56 PM
amworld
Thanks Alan and MAINTAIN Guru.


WebFOCUS 7.6
Windows, All Outputs