| Index
» Projekty
» phpMyEdit
» Fórum
» Javascript onfocus who ? |
 |
anax
Založený: 19.10.2007
Príspevky: 6
Zaslal: 2007-11-04 20:54
Návrat hore
Odpovedať s citátom
|
I had to do something similar... there might be more elegant ways, but this is what I did to get
| Citácia: |
| <input class="pme-input" name="pme-input-1-RightAlign" size="7" maxlength="7" value="0.00" onkeyup="Changetotal(this.value)" type="text"> |
on my Add and Edit screens.
| Citácia: |
$opts['fdd']['VAT'] = array(
'name' => 'VAT',
'help' => 'Amount of VAT paid',
/* etc. */
'php|AC' => 'VAT.php',
);
|
And I created a VAT.php file with...
| Citácia: |
<?php
$sql="SELECT myexpenditure.VAT FROM myexpenditure WHERE myexpenditure.TransactionID = ".$this->rec;
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
return '<input class="pme-input-1-RightAlign" name="PME_data_VAT" size="7" maxlength="7" value="'.$row['VAT'].'" type="text" onkeyup="Changetotal(this.value)">';
?> |
(I don't like having the query there, but couldn't work out how to get the value otherwise - I doubt you'd need that)
And I just added the javascript function to the top of the main file...
Hope that might help you.
|
anax
Založený: 19.10.2007
Príspevky: 6
Zaslal: 2007-11-19 02:56
Návrat hore
Odpovedať s citátom
|
The way I did (sorry if my example was hard to follow) was to create a php file that is just returning the javascript.
In the column you want to have your javascript call, you
| Citácia: |
$opts['fdd']['NumberToAdd'] = array(
'name' => 'NumberToAdd',
'php|AC' => 'NumberToAdd.php',
); |
Then create a file NumberToAdd.php, with something like
| Citácia: |
| return '<input type="text" name="sss" .... onfocus="dothis()">' |
And put function dothis() at the top of the PME page.
|
anax
Založený: 19.10.2007
Príspevky: 6
Zaslal: 2007-11-23 05:14
Návrat hore
Odpovedať s citátom
|
I can't see why your code isn't working, it looks very similar to what is working for me. The php file doesn't seem to be being called. Maybe try
$opts['fdd']['inv_inr'] = array(
'php' => 'domath.php'
);
to help track down the problem.
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2007-11-25 16:28
Návrat hore
Odpovedať s citátom
|
which version of phpMyEdit are you using ? (try a new one, probably from cvs)
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2007-11-26 14:04
Návrat hore
Odpovedať s citátom
|
yes it should :-)
this feature was implemented after 5.6 release. try cvs version (which quite stable at this time, it's very similar to 5.7.1 release)
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|