get-value

Chris Kelleher

Administrator
Staff member
Hi all

I have sort of a <form> question for you.

On a form, I create several select lists dynamically from my database. In
order for just the data for that select to go over, I append a 1, 2, 3 etc
to the end of the name being passed. Eg: level1, level2, etc. Otherwise, it
just appends all the codes into the variable - the contents of label would
be Eg: ag,ar,co,etc

On the other side, when I do the get value, how can I know which one was
passed?

The code I have is :
plevel = get-value("level").

Of course, level is not the name, it is level 1, etc.


What I need to know is how to do code for get-value when I want to do a
BEGINS with:
plevel = get-value(BEGINS("level")).
and actually get something.

Can this even be done?

OR

Can someone point me in the right direction on how I should be doing it?


Regards,


Marsha J. Johnston
Systems Analyst/ Web Administrator
Learning Resources Distributing Centre
Alberta Learning

Ph: (780) 427-5322
Fax: (780) 422-9750
Email: mjohnston@edc.gov.ab.ca
Web: www.lrdc.edc.gov.ab.ca

I'm out of my mind, but feel free to leave a message.
 

Chris Kelleher

Administrator
Staff member
To be honest I didn't understand what you ment, but
is it so that you want i.e 4 diff. selectionlists, and the 2nd relays on the
1th, the 3th relays on the 2th etc..???

Geir Otto
 

Chris Kelleher

Administrator
Staff member
You may want to use the VALUE attribute of the select options. Inside there,
would be something to get back at the record.

<select name="ID" size=1>
< !--WSS
FOR EACH a NO-LOCK
-->

<option value="`ROWID(a)`">`a.description`</option>

< !--
END.
-->

then to retrieve the value ya would do something like:

rowid_a = GET-VALUE("ID").

Then one can see the record chosen with:

FIND a NO-LOCK
WHERE ROWID(a) = TO-ROWID(rowid_a).

Is that what you were looking for? Or some variation....
 

Chris Kelleher

Administrator
Staff member
assign the whole get-value to a character variable then do the begins on the
variable. you could also use the SUBSTRING keyword to strip out what you
don't want. On the other hand you could strip the value of the fi6el3 before
it is read using JavaScript i.e. level.value=left(level.value, 5);
HTH

Charlie Stine, CPA, MBA
Senior Consultant
Protech Systems
cstine@pilot.infi.net
 

Chris Kelleher

Administrator
Staff member
Hi,
I couldn't understand the exact question... but from what I understood is
that you are looking for the values of selection list which have been build
up from the database, so you don't know the exact name of the fields.
But you are appending a number at the end of the field name "level" to
generate the new names, and you want to get the data from all selection
lists.
If I am right you can try this... otherwise please correct me....

IF request_method = "post" THEN DO:
DO i = 1 to n:
SelectListName = "value" + i.
pvalue = pvalue + get-value(SelectListName).
END.
END.

/* Here n = total number of selection lists built up ... this value can be
easily obtained from the database using the same condition as used by you
while creating the selection lists. */

This code will return you the total string after concatenating all the
selection lists and then you can use the substring option to get individual
values.

Regards,
Sumeet Aggarwal
Software Engineer
HCL Technologies limited
3, Udyog Vihar Phase I,
Gurgaon 122016
Tel: +(91) 124 342971/73, 342370 Extn: 333
Email: sumeeta@ggn.hcltech.com
 
Top