View Complete Thread | FoxWeb Forum Home
Search:
Date:    Msg ID:   
From:    Thread:   
Subject:   
I misunderstood your original question.  Instead of giving each select field the same, I recommend that you give it a name that identifies the current record.  If the form contains more than just the select fields in question, then you should probably add something to the name to make it identifiable.  In the example below I'm prepending each select field name with "sel_".  Do you really need the text field?  If you don't expect users to enter any text, just remove it:
 
<%SCAN%>

<TR>
<TD>
<SELECT NAME="sel_<%=table.key%>">
<OPTION VALUE="FIRST">FIRST OPTION</OPTION>
<OPTION VALUE="SECOND">SECOND OPTION</OPTION>
</OPTION>
</TD>
</TR>
<TR>
<TD><INPUT TYPE="TEXT" NAME="txt_<%=table.key%>" VALUE="_your_default_value_">
</TD>
</TR>
<%ENDSCAN%>
 
To read user input you will need to traverse all fields with a FOR NEXT loop as described in my previous post.
FoxWeb Support Team
support@foxweb.com email
Sent by Jeff Grippe on 07/09/2008 08:35:46 AM:
So the coding of the form itself is correct as I presented it?

I would use the same name for all select/option groups and then use the methods that you specified to retrieive the data?

If I am going to get back an array of data for the select/option groups then I am also going to need a parallel array so that I can know what each array element relates to in order to update the database. So does the following make sense?

<%SCAN%>

<TR>
<TD>
<SELECT NAME="ACTION">
<OPTION VALUE="FIRST">FIRST OPTION</OPTION>
<OPTION VALUE="SECOND">SECOND OPTION</OPTION>
</OPTION>
</TD>
</TR>

<TR>
<TD><INPUT TYPE="TEXT" NAME="KEY" VALUE="<%=table.key%>">
</TD>
</TR>
<%ENDSCAN%>

This is the same sample code as below but now I've also included something which will give me the database keys that go with the selected options.

Now I could use Request.FormArray for ACTION and for KEY to get two arrays which should be in sync and can be used to point back to the database. Please tell me if this makes sense or if I'm not understanding you correctly.

Thanks for the help.

Jeff

Sent by FoxWeb Support on 07/08/2008 12:40:45 PM:
You will have to use a Request.FormCount("ACTION") to find how many options were selected.  Once you know, you can use Request.Form("ACTION", n) to retrieve each value, where n is a number from 0 to the total number of selected options.  Alternatively, you can use the Request.FormArray method to retrieve an array of all options.  The documentation contains more details on the various methods of the Request object.  Here's some sample code:

TotalSelections = Request.FormCOunt("ACTION")

FOR i = 1 TO TotalSelections

    Response.Write(Request.Form("ACTION", i))

NEXT

 
FoxWeb Support Team
support@foxweb.com email
Sent by Jeff Grippe on 07/03/2008 12:21:54 PM:
Hi, thanks for the help

Suppose I have an HTML table that is on a form and populated by a cursor...

Suppose I want to use a SELECT / OPTION tag to allow the user to update information in multiple records...

How do you deal with the "NAME" property?

If I were to code

<%SCAN%>
<TR>
<TD>
<SELECT NAME="ACTION">
<OPTION VALUE="FIRST">FIRST OPTION</OPTION>
<OPTION VALUE="SECOND">SECOND OPTION</OPTION>
</OPTION>
</TD>
</TR>
<%ENDSCAN%>

Then every select option group would update the same form variable.

Is there a good way to do this?

Thanks,
Jeff