CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Registration Form

Print topic Send  topic

Author Message
Damian
Posted: 07/17/2004, 2:03 AM

Gday All,

I have a user registration form that wants to know what TOWN in what STATE
in what COUNTRY the user is from. Initially this will include all towns in
Australia.

It will be expanded to New Zealand and a couple of other countries (hey why
stop at one!).

We want to provide all the towns in a database to remove the possibility of
users misspelling their town and us not being able to search for them by
town (of course that wont stop me from misspelling the names!).

I created 4 tables -

members (including fields like id, first name, last name, email, password,
country, state, city etc)
country (including fields id, country)
state (including fields id, countryid, state)
city (including fields id, stateid, city)

I have tried a multistep registration form - so on step/page 3 they choose a
country from a list box (source is the country table) and hit Next.
Step/page 4 should then offer them a list of states from a list box (source
is the state table) for the selected country. Step/Page 5 should show them a
list of Cities from a list box (source is the city table) for the selected
State.

I have an inner join between members.country and state.countryid.

This isnt working! I get all my states (every one of them) show up and
multiple times. Im not sure how to tell the list box to only choose values
that match the previous choice eg: only choose cities that have a stateid
value that matches the value recorded in state in the current members table!

Oh yeah, the members record IS already written into the database. this is
done at the end of Step/Page 1. It does an Insert Record and the return page
is step/page 2. Page 2 requires a login (created on step 1). Step 2 shows
the correct users data using the CCSGetSession("UserLogin") to pull the
right users data. Page 2 does an Update (not Insert) and sends you to Page 3
where you choose a Country and so on...

If anyone can point me in the right direction it would be great. Otherwise
if anyone has an alternate method to try Im all eyes.

Damian

Damian
Posted: 07/20/2004, 5:33 AM

Im not sure what it is, whether my questions are just dumb, or too hard, or
miplained, or I smell funny, but I dont think anyone has EVER responded
to a single post I have made.
Walter Kempees
Posted: 07/20/2004, 6:59 AM

responding.
Can you send the SQL statements used, preferably with (including) the pages
from your project or the project.
No promises.
dataobjx


Posts: 181
Posted: 07/20/2004, 7:13 AM

You can try this on your states wizard page.
Place this on the BeforeBuildSelect of the States ListBox
What it does is simply perform a CCDLookup on the members table
based on the members session userid, and derives the country id.
It then passes the country id as a where clause.
If you currently have a where clause for the country id in the list box, take it out... this code replaces that.

I hope this works for you....

Function States ListBox_DataSource_BeforeBuildSelect()
'Custom Code @49-73254650
' -------------------------
' Write your own code here.
Dim sResult
Dim lngID
Dim lngCountryID

lngID = Session("userid")
If Len(lngID) > 0 Then
lngCountryID = CCDLookup("country_id", "members", "id=" & CCToSQL(lngID, "Integer"), DBInternet)
sResult = " country_id = " & lngCountryID
End If

If Len(sResult ) > 0 Then
If States ListBox.datasource.Where = EMPTY Then
States ListBox.datasource.Where = sResult
Else
States ListBox.datasource.Where = " AND " & sResult
End If
Else
States ListBox.Errors.AddError("Unable to determine Country ID<br>Execution Halted.")
Response.End 'Fix any errors
End If


' -------------------------
'End Custom Code

End Function
_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
Damian
Posted: 07/20/2004, 7:20 AM

Thanks DataObjx,

Im off to bed but will definitely try this in the morning. Thanks for your
response.

Damian
Damian
Posted: 07/20/2004, 7:21 AM

Thanks Walter,

I have sent you some files. Would love any suggestions.

Damian
Walter Kempees
Posted: 07/21/2004, 1:50 PM

It was your passionate "no one hears me...." that triggered my response.
Yes helping you out is great, that is what they are known for.
I will not try and beat them but........
Imagine this
Create a from on the table members triggered for Insert.
Have the user fill in all the items that in the database are marked for
'required.
After the insert, the record has actually been inserted, redirect to the
next form, supplying the id of the member table.
something like form2.php?id=nnn
This form, also on the member table will appear in Update mode.
On the form any data you like but at least the 4 drop down boxes in the
correct order, preferrably vertically.

each dropdown has it's own datatable, but in the properties of the
datasource you put
for table2: "where t2.region1Id = member.region1"
for table3: "where t3.region2Id = member.region2"
for table4: "where t4.region3Id = member.region3"
these will all fail, won't they....... therefore in each of the listboxes
set the JAVA client on change to window.submit
This fill force the record to update, storing the dropdown value in the
member table and start itself again
now the dropdown (the next) will work, this is also set to on change
window.submit
and so on and so on.
The most important thing is to have the form reappear until all data is
supplied, this you do by setting A value to done when done or something like
that.

It was fun dreaming this up, it will be fun to build, I will give it a try,
provided you supply me with Yes'answer.
PS Am a registered CCS user, also to the support fora but it is not possible
to check in to your support question.

Anyway you have got your moneys'worth on your cry for attention I think
It was a pleasure.

Walter SP Kempees.
Walter Kempees
Posted: 07/21/2004, 1:51 PM

Got you !
Check this http://213.10.55.10/damian
and let me know,......
Damian
Posted: 07/21/2004, 3:50 PM

I just tried it on your site Walter and it looks really good.

I will examine the javascript in your soource some more and try it on my
page.

Your efforts are so totally appreciated.

Yes and I have not yet come up with the answer.

You are not able to use the link I sent you to see the case?

I will work on this today and will mail you my results. Thankyou again!

- Damian
Damian
Posted: 07/21/2004, 6:01 PM

Fantastic Solution Walter -

By using the OnChange SubmitForm you allowed the CodeCharge required field
setting to not submit the data but ask for more info, while still retaining
the existing values.

The other key thing that you did that I was missing was in the List Box ->
Data Source -> Table Parameter you set it as Type Form and not Type URL.
this caused it to take the parameter from the actual form, i.e. the value
that was selected in the previous region, rather than look for it in the URL
(which was where I was using the JavaScript statements to mixed results).

Thankyou so much for your help!

- thanks Damian

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.