Fork me on GitHub

Producing a module from Javascript  Bottom

  • Hi:

    I am working on a JavaScript app. It works nicely so far. I want to use a graphics library like JPGraph or CHart Director to produce charts.

    How I can pass JS variables? In some minutes I will try using a HTML -> PHP converter to test the app within PHP. The information is obtained using:
    Variable 1<small>: $

    </small>

    Hmm many ideas floating here, Also, How I could pass the info to a file so users could save in their own hard disk (local)??

    Anyone with experience doing this kind of stuff?

    TIA
  • I've not done this in particular, but keep in mind where each language is processed. PHP is server-side, while JS is client-side. In other words, if you want to use PHP to come up with JS values, then it must be done (via HTTP) before the JS...and of course, for each time PHP is required to process something, it's going to take another HTTP request.

    BTW...quote your attributes.

    ie,

    ...should be...

    ...and...

    ...should be...
  • Thanks Alar:

    Besides the align, value and name, where the "" are needed?.

    The application works fine as HTML but when I try the Non Standard Module -- that I am coding. I am having problem with the below code (popups) returning value (passing the value) to the main page... It is not returning it. Could it be the misisng quotes? I receive no error and thats makes it worse..

    Basically this is the index.php



    This is the popup...




























    Favor de Llenar estos blancos (estimado mensual):
    Teléfono :
    AEE - Energia Eléctrica :
    AAA :
    Otro:



    Thanks Again
  • I'm not a JS guru by any means, and I'm not sure about quoting standards for that.

    But...with HTML, there's a general rule to go by. Basically, everything on the right of an = sign is going to get quoted...so based on the HTML listed in your post...

    size="xxx"
    name="xxx"
    onload="xxx"
    colspan="xxx"
    value="xxx"
    align="xxx"
    type="xxx"
    charset="xxx"
    http-equiv="xxx"
  • BTW...for JavaScript help...(or any non-PostNuke-centric help) I always head over to the code forums at SitePoint.com. There's a lot of people there with specific knowledge on everything, and you'll often get an answer within minutes.
  • No luck. Have posted to SitePoint. Could this be related with PostNuke settings?? I have tried changing some but no luck also I am concerned about Site Security...

    The problem is the Popup not passing back the value it gets. This is a Budget application. IF I could make it work within PostNuke I plan on releasing it as Non Standard Module. Only problem will be expense and income categories will be fixed. But it could be improved once it works...

    I do had some previous problems with this section of the popup:
    self.creator.document.forms[0].elements[10].value = gTotal
    self.close()
    self.creator.document.forms[0].elements[12].focus()
    return true

    But now I receive no error message. That section determines the position where the values received by the popup are placed...

    What is amazing is that .htm works fine. Only change here is the index.php...

    Thanks Again.
  • As for alar's serverside client side stuff, if you save a javascript as a js file and refer to it in a webpage this will make it server side.
    Regardless, you've got a form as the trigger to your whole shpeal.
    I don't think you're passing the value correctly.
    Forms are always my worst nightmare in javascript/html coding. I always do something stupid and it looks perfectly fine and grrrr.... Quite candidly I see too many zeros it makes my head spin;) I like to make myself little javascript alert boxes telling me the value. so in all your houadd, houcancel etc functions make it alert you to the variables value.
    Somewhere you are making it equal zero by accident.
    FYI I once forgot to declare a var as a number and it gave me squat too and had the same nothing effect as yours.

This list is based on users active over the last 60 minutes.