Forums

CSS

This topic is locked

From table to form

Posted 15 Feb 2008 15:35:24
1
has voted
15 Feb 2008 15:35:24 fabiola jod posted:
I'm using dreamweaver mx.I have a form called evaluation form.I also have an access database that i use to store data.I want the user to open the form and select a value in combo box called cborecnum.When the user selects the value in combo box i want it to display the data in the table on
the form.after the user makes the necessary changes i want to update the database.

Replies

Replied 16 Feb 2008 10:53:17
16 Feb 2008 10:53:17 student 101 replied:
What you are asking is if I understand this one.
You want to display the table data before you update the entry into the database, using a select or combo box?

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
I'm using dreamweaver mx.I have a form called evaluation form.I also have an access database that i use to store data.I want the user to open the form and select a value in combo box called cborecnum.When the user selects the value in combo box i want it to display the data in the table on
the form.after the user makes the necessary changes i want to update the database.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 18 Feb 2008 07:29:41
18 Feb 2008 07:29:41 fabiola jod replied:
No i already have data in the table but sum fields are empty.When i click on the combo box on my form i want it to populate the data that is already entered.After i fill in the empty fields i want to update the record in the database.
Replied 18 Feb 2008 08:40:55
18 Feb 2008 08:40:55 student 101 replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
No i already have data in the table but sum fields are empty.When i click on the combo box on my form i want it to populate the data that is already entered.After i fill in the empty fields i want to update the record in the database.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Do you need an update query?
PHP or ASP?

Got this one from here: www.freewebmasterhelp.com/tutorials/phpmysql/7
<pre id=code><font face=courier size=2 id=code>$query="UPDATE contacts SET id='$ud_id' WHERE id='$ud_id'";
mysql_query($query);
echo "Record Updated";
mysql_close();</font id=code></pre id=code>

If that's not right, try this link, remember to check out the demo
www.tecnorama.org/document.php?id_doc=62

I am not fully understanding what it is you need?
Cheers



Edited by - westmatrix99 on 18 Feb 2008 08:46:11
Replied 18 Feb 2008 08:44:25
18 Feb 2008 08:44:25 student 101 replied:
If I understand this one properly, which I may not.

You have a table (please post the code remember to use the code tags)
You want to use a combo box to display the data on the page after you've added to it?
Now I am lost.

Rather post the code, remember to use the code tags...
Cheers
Replied 18 Feb 2008 10:28:31
18 Feb 2008 10:28:31 fabiola jod replied:
Let me start from scratch.I have two forms and ms access table.The name of the two forms are input and evalution form.My input form has less fields than the evaluation.Evaluation form has all the fields input form has and also extra fields.My tblmrp has all the fields that are in input and evaluation forms.On my input form which is an asp form i have the following code that inserts data in the table on the submit button click
&lt;%
If Request.Form("btnSubmit" = "Submit" Then
Set input_data=db.Execute("Insert Into tblMRP (Vessel,Rec_Num,material_desc,material_num,current_crit_code,new_crit_code,current_mrp_profile,suggested_mrp_profile,base_unit,current_max,new_max,current_lot_size,new_lot_size,ucomments,username,auth_rec,completed,date_completed,current_rop,new_rop) Values ('"& Request.Form("cboVessel"& "', '" &Request.Form("txtRecordNum"& "','" &Request.Form("txtMaterialDesc"& "','" &Request.Form("txtmaterialnum"& "','" & Request.Form("cbocurrentcritcode"&"','" &Request.Form("cbonewcritcode"&"','" &Request.Form("cbocurrentmrpprofile"&"','" &Request.Form("cbosuggestedmrpprofile"&"','" &Request.Form("txtunitofmeasure"&"','" &Request.Form("txtcurrentmax"&"','"&Request.Form("txtnewmax"&"','"&Request.Form("txtcurrentlotsize"&"','"&Request.Form("txtnewlotsize"&"','"&Request.Form("txtusercomments"&"','"&Request.Form("txtusername"&"','" &Request.Form("cboreqchangeauth" &"','" & Request.Form("cbocompleted"&"','" &Request.Form("txtdatecompleted"
&",'"& Request.Form("txtcurrentrop"&"','"& Request.Form("txtnewrop"&"')"
Set input_data=nothing

End If
%&gt;
Not all the fields are updated since some fields are only in the evaluation form.On my evalution form i have a combo box called cbochangeno that gets data from the rec_num in the tlbmrp.On evalution form open i refresh the form so that all the data in the rec_num field comes through the cbochangeno.What i want to do is if the user selects the value in the combo box on the evaluation form it should populate data from the table on the form excluding the extra fields that the evalution form.The user inserts data in the extra fields and on the update button it should update the rest of the fields in the table.


Edited by - hendrinajod on 18 Feb 2008 10:38:45
Replied 18 Feb 2008 10:35:02
18 Feb 2008 10:35:02 student 101 replied:
So this page catches the form data you just posted?
Replied 18 Feb 2008 11:01:04
18 Feb 2008 11:01:04 fabiola jod replied:
Yes it does.On the evaluation form when the user selects the value in
combo box i want it to bring out data based on that value .the user
then fills in the rest of the fields and updates the record
Replied 18 Feb 2008 11:05:32
18 Feb 2008 11:05:32 student 101 replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Yes it does.On the evaluation form when the user selects the value in
combo box i want it to bring out data based on that value .the user
then fills in the rest of the fields and updates the record
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Tecnorama has what you need:
www.tecnorama.org/document.php?id_doc=62
Replied 19 Feb 2008 11:50:18
19 Feb 2008 11:50:18 fabiola jod replied:
Thanks it worked.Now i have another problem.After the data is
populated on the form.I edit the form.Everytime time i click the
update button it brings out the original data.
&lt;%
If Request.Querystring("btnUpdate" = "Update" Then
Set uclient_data=db.Execute("UPDATE tblmrp SET = '"&Request.Querystring("txtmaterialnum"&"'"_
&", material_num = '"&Request.Querystring("txtmaterialnum"&"'"_
&", material_desc = '"&Request.Querystring("txtmaterialdesctxtbaseunit"&"'"_
&", base_unit= '"&Request.Querystring("txtbaseunit"&"'"_
&" WHERE cboChangeNo= '"&request.form("rec_num"&"'"

End If
%&gt;
The code above is the one i use on my update click.i want it to update the field not bring the original.it
Replied 19 Feb 2008 14:48:45
19 Feb 2008 14:48:45 student 101 replied:
Not sure what you want to do but here is a redirect after udpate.
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Dim MM_edit

MM_edit = "UPDATE tblmrp SET fieldname ="& Request.Querystring("txtmaterialnum" &", material_num ="& Request.Querystring("txtmaterialnum"& ", material_desc = "& Request.Querystring("txtmaterialdesctxtbaseunit"& ", base_unit= "& Request.Querystring("txtbaseunit"& " WHERE cboChangeNo = "& Request.form("rec_num" &""

Dim MM_editRedirectUrl
MM_editRedirectUrl = "filename.asp"
Response.Redirect(MM_editRedirectUrl)
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Similar to this one below.
<pre id=code><font face=courier size=2 id=code>
ID = 1 'or from db or anywhere

' declaring variables
' not neccesary but a good habit
Dim DataConn
Dim CmdInsertRecord
Dim MYSQL

Set DataConn = Server.CreateObject("ADODB.Connection"
Set CmdInsertRecord = Server.CreateObject("ADODB.Recordset"

' The line below shows how to use a system DSN instead of a DNS-LESS connection
' DataConn.Open "DSN=System_DSN_Name"
DataConn.Open "DBQ=" & Server.Mappath("../_database/database.mdb" & ";Driver={Microsoft Access Driver (*.mdb)};"

MYSQL = "UPDATE some_table SET NAME = 'Joe Bloe', EMAIL = ' ' WHERE (ID = " & ID & ""

CmdInsertRecord.Open MYSQL, DataConn

' closing objects and setting them to nothing
' not neccesary but a good habit
DataConn.Close
Set DataConn = Nothing
</font id=code></pre id=code>
Cheers

Edited by - westmatrix99 on 19 Feb 2008 14:51:30
Replied 20 Feb 2008 15:22:17
20 Feb 2008 15:22:17 fabiola jod replied:
thanks it worked.I don't know if i'll make myself clear on this.when
the user selects the option value from combo box and inserts it in
the table.it saves that option value.
eg &lt;td&gt;New Criticality Code:&lt;/td&gt;
&lt;td&gt;&lt;select name="cboNewCritCode"&gt;
&lt;option value="N"&gt;Normal&lt;/option&gt;
&lt;option value="P"&gt;Order as Required&lt;/option&gt;
&lt;option value="C"&gt;Critical Item&lt;/option&gt;
&lt;option value="O"&gt;Obsolete Item&lt;/option&gt;
&lt;option value="I"&gt;Insurance&lt;/option&gt;
&lt;option value="D"&gt;Dormant&lt;/option&gt;
In this case the value saved in the database is N if the user clicks Normal
and P if the user clicks on Order as required.
The problem is when i populate my data from the table to my evaluation form.
the form.it brings the option value.I want it to display Normal not N
Replied 20 Feb 2008 15:29:10
20 Feb 2008 15:29:10 student 101 replied:
Your combo box has the <b>value</b> of <b>"N"</b> that's why it displays "N" and not "Normal"

<b> &lt;option value="N"&gt;Normal&lt;/option&gt; </b>
Should be
<b> &lt;option value="Normal"&gt;Normal&lt;/option&gt; </b>

Cheers

Replied 21 Feb 2008 08:51:56
21 Feb 2008 08:51:56 fabiola jod replied:
Ok i don't know what happened but ny code is suddenly not working.
&lt;%

If Request.Querystring("btnUpdate" = "Update" Then
Set uclient_data=db.Execute("UPDATE tblmrp SET Name = '"&Request.Querystring("rec_num"&"'"_
&", material_num = '"&Request.Querystring("txtmaterialnum"&"'"_
&", material_desc ='"&Request.Querystring("txtmaterialdesc"&"'"_
&", base_unit='"&Request.Querystring("txtbaseunit"&"'"_
&", mrp_comments='"&Request.Querystring("txtMRPComm" &"'"_
&", curr_turnover_rate='"&Request.Querystring("txtcurrentturnrate" &"'"_
&", price_unit='"&Request.Querystring("txtUnitPrice" &"'"_
&", WHERE rec_num='"&Request.form("txtChangeNo"&"'"
Response.Redirect "display.htm"
End If
%&gt;
This code is supposed to update the tblmrp and redirect to the to
another page that says your changes have been updated suuccessfully.
I tried everything it's not doing anything at all.I'll really appreciate if you can take a look.
I might be missing something.I just don't knoe what.
Replied 21 Feb 2008 08:58:36
21 Feb 2008 08:58:36 student 101 replied:
I know from experience that when updating a record there should be a reference to the record.
Check if you have the proper connection string?
Replied 21 Feb 2008 13:31:34
21 Feb 2008 13:31:34 fabiola jod replied:
Hi again.I didn't know dreamweaver will be this complicated.I edited the
code.can you take a look.I just does not do anything.

&lt;%
Dim MM_edit
If Request.Querystring("btnUpdate" = "Update" Then
MM_edit.open = "UPDATE tblmrp SET fieldname ="& Request.Querystring("txtChangeNo" &", material_num ="& Request.Querystring("txtmaterialnum"& ", material_desc = "& Request.Querystring("txtMaterialDesc"& ", base_unit= "& Request.Querystring("txtBaseUnit"& ", material_num= "& Request.Querystring("txtMaterialNum"& ",mrp_comments= "& Request.Querystring("txtMRPComm"& " WHERE cboChangeNo = "& Request.form("rec_num" &""
Dim MM_editRedirectUrl
MM_editRedirectUrl = "display.htm"
Response.Redirect(MM_editRedirectUrl)
End If
%&gt;
It is supposed to update my table in ms-access database.
If you can suggest anything i can do it's fine i'll just try.I'm struggling with this code since yesterday.Thanks
Replied 21 Feb 2008 13:36:53
21 Feb 2008 13:36:53 student 101 replied:
Are you using dreamweaver?
Which version?

Then just use the dreamweaver update record wizard.
If it's CS3 then remember to remove the (primary key field) from the update record part as DW will add it in.

Cheers
Replied 22 Feb 2008 10:15:35
22 Feb 2008 10:15:35 fabiola jod replied:
thanks on the DmX updates.I have a question though.On my evaluation form
i have combo boxes.When the user selects the value in combo box i want
it to display an error message saying "You cannot change the value"
Thanks i know it's probably easy but i'm struggling.
Replied 22 Feb 2008 11:21:39
22 Feb 2008 11:21:39 student 101 replied:
Try yaramot's "checkform"
Replied 26 Feb 2008 10:45:28
26 Feb 2008 10:45:28 fabiola jod replied:
Hi.Is it possible to do calculations dreamweaver asp pages
Replied 26 Feb 2008 11:01:02
26 Feb 2008 11:01:02 student 101 replied:
There is a calc form or something to that effect on Yaro's site or on massimo's corner
It adds and subtracts I think - never used but have seen it.

Replied 06 Mar 2008 08:03:32
06 Mar 2008 08:03:32 fabiola jod replied:
I'm using dreamweaver mx with asp pages.In my form i have a table.
I have a text field called txtmax and another text field called txt unit price.
Theres is another field called txtturnover_rate.All text fields only take numeric values.
What i want to do is to calculate the value for txtturnover_rate.my formulais
Formula=12/txtunitprice*txtmax/consumptionvalue/12.i don't know how to do the calculations on the
form.
Replied 06 Mar 2008 09:40:16
06 Mar 2008 09:40:16 student 101 replied:

Formula=12/txtunitprice*txtmax/consumptionvalue/12

Download and install the extension: <b>CALCULATE FORM</b>
www.yaromat.com/dw/?t=All&r=All&ipp=50&sn=24

It's pretty simple once you have this extension to do it for you, otherwise you would do it with ASP code.
<pre id=code><font face=courier size=2 id=code>
Dim val1, val2, calculateit
val1 = 12
val2 = 12
calculateit = val1 / txtunitprice * txtmax / consumptionvalue / val2

Response.Write(calculateit)
</font id=code></pre id=code>
Replied 06 Mar 2008 10:42:30
06 Mar 2008 10:42:30 fabiola jod replied:
I'm using dreamweaver mx with asp pages.In my form i have a table.
I have a text field called txtmax and another text field called txt unit price.
Theres is another field called txtturnover_rate.All text fields only take numeric values.
What i want to do is to calculate the value for txtturnover_rate.my formulais
Formula=12/txtunitprice*txtmax/consumptionvalue/12.i don't know how to do the calculations on the
form.I want this value to be displayed in field txtxcurrentturnover rate when the form opens.
Replied 06 Mar 2008 11:04:40
06 Mar 2008 11:04:40 student 101 replied:
Have you tried the calculate form extension?
Replied 12 Mar 2008 10:21:39
12 Mar 2008 10:21:39 fabiola jod replied:
Hi i got some usefule tips from yaromat.i have another problem.I'm using an ms-access to populate data from the table onto my form.The problem i have is my combo boxes cuts the text after the quotes.if the user selects a text with double quotes it only display the text withinthe quotes.i want it to display everything

Reply to this topic