[development] help with input user field development / module

floretan at gmail.com floretan at gmail.com
Fri Dec 21 17:52:34 UTC 2007


If you want to be able to change the currency dynamically, you can
create a little jquery script that will modify the content of your
page. Put the original value in hidden fields with a class
"original-value" and append the converted value to the hidden field:

$(document).ready(function() {
  $('input.original-value').each(function() {
    $(this).after(($(this).val() * exchange_rate) + 'euros');
  });
});

This is just a basic idea, but a script that loads the currency and
the associated exchange rate from a form, as well as creating correct
html code should not be much longer.

You would still need some server-side conversion for users who don't
have javascript enabled, but depending on your needs this might not be
an issue.

On 12/21/07, Alex Moreno <al3xmor3no at gmail.com> wrote:
> seems a good solution. By the way i want to let the user the
> posibility to modify the currency himself. Until now i´ve built a
> module that allows him to insert the currency, and i store this value
> on the database. How can i access to this value from php? I know that
> i can use node-> * to access some values, but i don´t know how to
> access other external data not in the node.
>
> Thanks a lot for your help.
>
> On 21/12/2007, Brett Evanson <brettev at gmail.com> wrote:
> > There is a 'computed field' module for cck. this wouldn't take into
> > consideration current exchange rates dynamically, but it might work.
> >
> > --
> > Brett Evanson
> >
> > -----Original Message-----
> > From: development-bounces at drupal.org
> [mailto:development-bounces at drupal.org]
> > On Behalf Of Alex Moreno
> > Sent: Friday, December 21, 2007 2:29 AM
> > To: development at drupal.org
> > Subject: [development] help with input user field development / module
> >
> > Hi everybody,
> >
> > i need to develop a module that simply accepts an input user, say for
> > example a currency conversion. I need to use this data to make a
> > conversion in views module.
> >
> > I have a type of content with a field named price. The user inserts a
> > new page of this type of content and fills the price. The final
> > objective is to be able to get from views the conversion ratio to
> > apply the needed conversions and show the price in 2 different
> > currencys.
> >
> > I don´t need to use an ecommerce module because the web is much more
> > symple than this. I also don´t know if that is the best or simplier
> > solution.
> >
> > Anyone could guide me on how to start or where to look for more
> information?
> >
> > Thanks a lot in advance.
> >
> > --
> > Alejandro Moreno López
> > Publicidad en Buscadores y Marketing Online
> > http://www.tdo.es
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.516 / Virus Database: 269.17.5/1191 - Release Date:
> 12/20/2007
> > 2:14 PM
> >
> >
> > No virus found in this outgoing message.
> > Checked by AVG Free Edition.
> > Version: 7.5.516 / Virus Database: 269.17.6/1192 - Release Date:
> 12/21/2007
> > 1:17 PM
> >
> >
> >
>
>
> --
> Alejandro Moreno López
> Publicidad en Buscadores y Marketing Online
> http://www.tdo.es
>


More information about the development mailing list