|
Go
![]() |
New
![]() |
Search
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Guru |
In the "Enhancing Maintain HTMLTables with HTML" Lab, there were 3 topics that required follow up. I am
putting the code for all 3 techniques in this forum. Please let me know if you have any questions or comments. Remember to set the Content Type of the field in the HTMLTable to 1 - HTML. I. Radio Button Code The code to include a Radio Button into the HTMLTable was omitted from the presentation. Here is the code:
Compute Stk(i).rbutton/a250 =
"<input type=radio name=radiox " || I || " value='G'>G " |
"<input type=radio name=radiox " || I || " value='NR'>NR " |
"<input type=radio name=radiox " || I || " value='PG'>PG " |
"<input type=radio name=radiox " || I || " value='PG13'>PG13 " |
"<input type=radio name=radiox " || I || " value='R'>R "
Compute I=I+1;
Endrepeat
And you can preset the item you want by using the word CHECKED: "<input type=radio name=radiox " || I || " value='NR' CHECKED>NR " II. Dynamic List Boxes The following code not only creates List Boxes, but populates them dynamically. The example uses the car file and displays all cars by country:
MAINTAIN FILE car
$$Declarations
Case Top
for all next country into stk
compute stk.slist/a200;
compute i/i2=1;
compute j/i2=1;
compute q/a1 = "'";
repeat stk.foccount
reposition country
stack clear stk2
for all next country car into stk2(2)
where country eq stk(i).country;
compute stk(i).slist = "<select name=list " || i || ">"
compute j=1;
repeat stk2.foccount
compute stk(i).slist = stk(i).slist ||
" <option value= " || q || stk2[j).car || q || ">" || stk2(j).car || "</option> "
compute j=j+1;
endrepeat
compute stk(i).slist = stk(i).slist || " </select>"
compute i=i+1;
endrepeat
Winform Show Form1;
EndCase
case showme
compute i=1;
repeat stk.foccount
compute stk(i).sel/a10 = Form1.GetHTMLField('list' || I);
compute i=i+1;
endrepeat
endcase
END
III. Presetting List box values Thanks to Tony A, we learned that adding 'selected' to the list box value pre-selects an item on a list box. Tony, I owe you an hour of consulting compute x1/A10=''; compute x2/A10=''; compute x3/A10=''; compute x4/A10=''; compute x5/A10=''; compute x6/A10=''; if stk(i).rating = ' ' then compute x1='selected'; if stk(i).rating = 'G' then compute x2='selected'; if stk(i).rating = 'NR' then compute x3='selected'; if stk(i).rating = 'PG' then compute x4='selected'; if stk(i).rating = 'G13' then compute x5='selected'; if stk(i).rating = 'R' then compute x6='selected'; Compute Stk(I).lbox/a250 = "<select name=list " || I || ">" | " <option value=' ' " || x1 || "> </option> " | " <option value='G' " || x2 || "> G</option> " | " <option value='NR' " || x3 || "> NR</option> " | " <option value='PG' " || x4 || "> PG</option> " | " <option value='PG13'" || x5 || ">PG13</option> " | " <option value='R' " || x6 || "> R</option> " | " </select>" Thank you to all of you that attended my sessions and labs. I hope to hear from you soon. Mark Derwin |
||
|
|
Expert |
Mark,
Comments eh? Just one to say that I thoroughly enjoyed your presentation and so relevant to a piece I am doing at the moment, thanks so much! As for the hour, I'll settle for another couple of excellent ppts next summit - it appears that I have got the taste for them!! T |
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

