This topic is locked

Some body have an idear

11/30/2007 8:03:19 PM
PHPRunner General questions
H
hsmdk author

Hello,
I have a task here and need some input to witch way I have to go.
I have a tabel with some fixed data non problem ! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=6951&image=1&table=forumtopics' class='bbc_emoticon' alt=':rolleyes:' />
e.g.

Tabel 1 - Fixed data

Filed 1 - ID

Filed 2 - Name

Field 3 - XXX

Field 4 - yyy
Now I what to have a formula where the user can fulfil some fields and choose in a pick list (look up) one value form tabel 1.

But I need the system to fulfil some of data from tabel 1 into certain fields.
e.g

Filed 1 - ID

Filed 2 - username

Filed 3 - Date

Filed 4 - Value from tabel 1 via look up (field2)

Field 5 - Value from tabel 1 (field3) should be fulfil when a value from the look up is choosed.

Field 6 - Value from tabel 1 (field4) should be fulfil when a value from the look up is choosed

Field 7 - ZZZZ

Field 8 - PPPP
I hope there are a kindly soul there can lead me on the right track <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=6951&image=2&table=forumtopics' class='bbcemoticon' alt='<<' />

J
Jane 12/3/2007

Hi,
use dependent dropdown boxes for this purpose.
Here are some helpful PHPRunner flash tutorials:

http://xlinesoft.com/phprunner/php-database.htm

H
hsmdk author 12/3/2007

Hi,

use dependent dropdown boxes for this purpose.
Here are some helpful PHPRunner flash tutorials:

http://xlinesoft.com/phprunner/php-database.htm


Dear Jane,
Thanks for you proposal.
I looked at it, but when you use dependent dropdown the user have to (as I understand) pick in every fields. What I want is, pick one value, and the form will fulfil some fields form the table I generate the dropdown from.
how can i do that ?

J
Jane 12/4/2007

Hi,
I guess you have some problems understanding what kind of dropdowns these tools can build for you.

I recommend to check the following live demos (Orders --> Order details --> Add page --> select category and product):

http://livedemo.asprunner.net/phprunner/livedemo1/menu.php

H
hsmdk author 12/6/2007

<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=23948&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />
Thanks - you gived me a track for a solution off my task
But now i have a new callange.
I have these fields
Filed 1 - ID

Filed 2 - username

Filed 3 - Date

Filed 4 - Value from tabel 1 via look up (field2)

Field 5 - Value from tabel 1 (field3) should be fulfil when a value from the look up is choosed.

Field 6 - Value from tabel 1 (field4) should be fulfil when a value from the look up is choosed

Field 7 - data user type in

Field 8 - total
I can easly get the total field updatet when the user push "save" but i would like to see (one the screen) the result before that.
how can i do that ?

Alexey admin 12/7/2007

Hi,
you can add some javascript code to the Save button for this.

Or use Before record added/updatedevent to update "total" field value.

H
hsmdk author 12/9/2007

Hi,

you can add some javascript code to the Save button for this.

Or use Before record added/updatedevent to update "total" field value.


Hi,
I used this in the BeforeAdd
$values["Felt5"] = $values["Felt4"]+$values["Felt3"]
And this work fine in the DB, that means the result is updatet i the DB.
Put i want to se the result on the screen before "save"
how is this possible ?
Regards

Alexey admin 12/10/2007

Hi,
to calculate totals before on the page add some Javascript code to your page.

Add onchange or onblur handlers to your controls for this.

I.e. add this code to your page in HTML mode on the Visual Editor tab:

<script language=javascript>

function calctotal()

{

document.editform.value_Felt5.value=parseFloat(document.editform.value_Felt3.val

ue)+parseFloat(document.editform.value_Felt4.value);

}

value_Felt3.onblur = calctotal;

value_Felt4.onblur = calctotal;

</script>

H
hsmdk author 12/28/2007

Hi,
i have tryed to set the script into the html code but is not working !
here are the HTMLcode - where do i set it in
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>test2</TITLE>

<META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK

href="include/style.css" type=text/css rel=stylesheet>{$includes}

<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>

<BODY {$bodyonload}>{include_if_exists file="include/header.php"}

<FORM name=editform action=_test2_add.php method=post

encType=multipart/form-data {$onsubmit}>{doevent name="AddOnLoad"}

<TABLE class=main_table2 cellSpacing=0 cellPadding=4 align=center border=0>

<TBODY>

<TR>

<TD class=upeditmenu vAlign=middle align=middle width="100%" colSpan=2 height=31>test2, Add new record </TD></TR>

<TR>

<TD class=downedit align=middle colSpan=2>{$message}</TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px" width=150>TESTID</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px" width=250>{build_edit_control field="TESTID" mode="add" value=$value_TESTID} </TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px" width=150>Felt1</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px" width=250>{build_edit_control field="Felt1" mode="add" value=$value_Felt1} </TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px" width=150>Felt2</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px; BACKGROUND-COLOR: #fff4d8"

width=250>{build_edit_control field="Felt2" mode="add" value=$value_Felt2} </TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px" width=150>Felt3</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px" width=250>{build_edit_control field="Felt3" mode="add" value=$value_Felt3} </TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px" width=150>Felt4</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px" width=250>{build_edit_control field="Felt4" mode="add" value=$value_Felt4} </TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px" width=150>Felt5</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px" width=250>{build_edit_control field="Felt5" mode="add" value=$value_Felt5} </TD></TR>

<TR>

<TD class=toplist vAlign=middle align=left colSpan=2 height=30><IMG

src="images/icon_required.gif"> - Required field </TD></TR>

<TR vAlign=top align=middle height=40 colSpan="2" <TD><SPAN

class=buttonborder><INPUT class=button type=submit value=Save name=submit1></SPAN>

<SPAN class=buttonborder><INPUT class=button type=reset value=Reset></SPAN>

<SPAN class=buttonborder><INPUT class=button onclick="window.location.href='_test2_list.php?a=return'" type=button value="Back to list"></SPAN>

<input type=hidden name="a" value="added"></TD></TR></FORM></TBODY></TABLE>{include_if_exists file="include/footer.php"}

{$linkdata}</BODY></HTML>

Thanks.....

Hi,

to calculate totals before on the page add some Javascript code to your page.

Add onchange or onblur handlers to your controls for this.

I.e. add this code to your page in HTML mode on the Visual Editor tab:

J
Jane 12/29/2007

Hi,
here is a sample:

...

</HEAD>

{literal}<script>

function calctotal()

{

document.editform.value_Felt5.value=parseFloat(document.editform.value_Felt3.val

ue)+parseFloat(document.editform.value_Felt4.value);

}

value_Felt3.onblur = calctotal;

value_Felt4.onblur = calctotal;

</script>{/literal}

<BODY {$bodyonload}>{include_if_exists file="include/header.php"}

<FORM name=editform action=_test2_add.php method=post

...