is this code possible to integrate in the custom tags?

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
sticcino
User
Posts: 1043

is this code possible to integrate in the custom tags?

Post by sticcino »

Hi,

just trying to figure out if this is possible to put into the custom tags of phpmaker, instead of manually hacking the code

the field is a currency field that I already put in custom edit attributes as follows:
$this->B_Counter_Offer_Price->EditCustomAttributes = "<script type=\"text/javascript\">$(\"#x_B_Counter_Offer_Price\").maskMoney({thousands:',', decimal:'.', allowZero: true, allowNegative:false, prefix: ' $'});</script>";

it displays the numbers to currency on the fly in the edit box...

I want to incorporate another lib (php) that will print out the word translation of the entered currency (ten dollars), next to the input field as the input value changes... at placeholder <WOULD_LIKE_CURRENCY_TO_WORDS_HERE>. This is the function code slimmed down.

$converter = new MoneyToWordsConverter($Amount, "dollars");
echo ($converter->Convert());

the field:
<input type="text" data-table="tbl_property_offers" data-field="x_B_Counter_Offer_Price" data-page="2" name="x_B_Counter_Offer_Price" id="x_B_Counter_Offer_Price" size="10" placeholder="<?php echo ew_HtmlEncode($tbl__offers->B_Counter_Offer_Price->getPlaceHolder()) ?>" value="<?php echo $tbl_offers->B_Counter_Offer_Price->EditValue ?>"<?php echo $tbl_offers->B_Counter_Offer_Price->EditAttributes() ?>>
WOULD_LIKE_CURRENCY_TO_WORDS_HERE</span>

I'm figuring I could probably shove the php code in the EditAttributes(), but not sure how it would display the result next to the field if at all possible. or maybe have a startup script of onchange event for x_B_Counter_Offer_Price, but then again how to display after the input field.

any thoughts,
Johnny


arbei
User
Posts: 9288

Post by arbei »

You can use the Startup Script of the Add/Edit page to run your code.
For example:
$("#x_B_Counter_Offer_Price").maskMoney({thousands:',', decimal:'.', allowZero: true, allowNegative:false, prefix: ' $'});
$("#x_B_Counter_Offer_Price").attr("placeholder", "<new placeholder>");


Post Reply