How to prefill the Form?
am 13.06.2006 16:55:02 von sdmusicmaker
Hi,
interesting puzzle that has me a bit stumped. I have an ASP detail page that
shows an image of a product , checkboxes and a submit button. The quanity of
checkboxes on the page is determined by the value of DB lookup to a table
that has a column called MaxHoles. So for instance if the product has three
holes (MaxHoles column value is 3 in the table), then the ASP page shows the
image and an A B and C check box. If the value was 5 then it would show 5
boxes to choose from A B C D E. The user chooses the configuation by
selecting the checkboxes and when they submit the page it writes the values (
A, B C , etc) to another table. This all works fine.
The question is, after you submit that page, you are taken back to a master
grid page which has a column called Layout where if you clicked it takes you
to the ASP detail page we were just talking about. The detail page simply
shows you a picture of the product and gives you a chance to choose
checkboxes to specify your configuation options.
I need the user to be able to click the existing link in the grid on the
master page and when they are again presented with the page that has the
check boxes their previous selections for the checkboxes are prefilled. So if
they choose A, B and C, then go back to the master page and want to change
their mind, they click on the layout link (BTW, master page and already
working, i'm passing the lineID number to the detail page via querystring) on
the master page and when the detail page comes up it has 3 boxes A, B and C
and they are checked. Because the master page grid has several rows that
could each have an item that also has a layout link i dont think a cookie
would work. i know it is a database solution but I'm not sure which way to go.
Any thoughts?
sd
Re: How to prefill the Form?
am 13.06.2006 18:27:35 von Mike Brind
sdmusicmaker wrote:
> Hi,
> interesting puzzle that has me a bit stumped. I have an ASP detail page that
> shows an image of a product , checkboxes and a submit button. The quanity of
> checkboxes on the page is determined by the value of DB lookup to a table
> that has a column called MaxHoles. So for instance if the product has three
> holes (MaxHoles column value is 3 in the table), then the ASP page shows the
> image and an A B and C check box. If the value was 5 then it would show 5
> boxes to choose from A B C D E. The user chooses the configuation by
> selecting the checkboxes and when they submit the page it writes the values (
> A, B C , etc) to another table. This all works fine.
>
> The question is, after you submit that page, you are taken back to a master
> grid page which has a column called Layout where if you clicked it takes you
> to the ASP detail page we were just talking about. The detail page simply
> shows you a picture of the product and gives you a chance to choose
> checkboxes to specify your configuation options.
> I need the user to be able to click the existing link in the grid on the
> master page and when they are again presented with the page that has the
> check boxes their previous selections for the checkboxes are prefilled. So if
> they choose A, B and C, then go back to the master page and want to change
> their mind, they click on the layout link (BTW, master page and already
> working, i'm passing the lineID number to the detail page via querystring) on
> the master page and when the detail page comes up it has 3 boxes A, B and C
> and they are checked. Because the master page grid has several rows that
> could each have an item that also has a layout link i dont think a cookie
> would work. i know it is a database solution but I'm not sure which way to go.
>
> Any thoughts?
>
Cookie is the best option, otherwise you continually have to ask the
visitor who they are through login forms. This is how I would do it:
Store a Visitor ID and/or Configuration ID on a cookie when they have
saved a configuration.
On the details page, check to see if the cookie exists. If it does,
read the ID number and query the database for the visitor's saved
configuration.
Then in your code for creating the checkboxes, you will need something
like this pseudo code (depending on how you stored the user's
preference):
For i = 1 to maxholes
Response.Write start of checkbox details
If saved value for number of holes for this user = i Then
Response.Write " checked"
End If
Resposne.Write rest of checkbox html &
& vbcrlf
Next
--
Mike Brind