SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is it possible to do this, without any javascript ?

    Is it possible to set up some sort of automatic conversion of kilos to pounds for example, but without using any js at all ?

    Any help appreciated.

    Dez.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The only way to do it without JavaScript is to use server side scripting and have the form where the figure to be converted is entered submit a request to load a new page containing the answer.

    To do any sort of calculation without involving the server requires the use of JavaScript.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Stephen, I wouldn't want to chance any of the users not being able to see it.

    What choices of server side scripting are there for this scenario please ?

    Dez.

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,172
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    There are lots, but PHP is probably the best to use. You'd best head over to the PHP forum to see if anyone has any suggestions/scripts that you could use.

  5. #5
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Dez, you can use whatever server-side language you like (as long as it's supported by the server), for something as simple as unit conversion I wouldn't go with Ruby or Python because they would be overkill, but PHP, ASP(.NET), JSP, Perl or ColdFusion would do the job (depending on your preference and what your host supports).

  6. #6
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't know about the rest of the script types, but my hosts definitely support php. But wouldn't site B hosts need to support it as well ?

  7. #7
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Nope, only the site executing and parsing the data would need the server-side language (as it's just taking the static results and doing something with it)

  8. #8
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But wouldn't there be any security issues for site B, receiving stuff from another site ?

  9. #9
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    You haven't explained how site B fits into your having a calculator on your site.

    All that is normally involved in setting up a calculator like that is the one site that the calculator is on. Any other site can then use the calculator simply by providing a link to the page that the calculator is on.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  10. #10
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many thanks Stephen and Alex - will put some more of this into the PHP forum.

    BTW, what would be the pros and cons of using PHP for this, over the other script types mentioned above by Alex please ?

  11. #11
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    It all comes down to what server side languages your hosting provides for you to use and which of those if any that you already know. If your hosting provides several languages and you don't know any of them yet then it comes down to which one you decide to learn.

    PHP has a slight advantage over some of the alternatives that you are likely to find on the same hosting as there are more people using it and therefore more people to get help from.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  12. #12
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Stephen, I'll look into php.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •