Announcement

Collapse
No announcement yet.

PHP Methods and passing parameters

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Methods and passing parameters

    I have created a PHP Method in a form to test certain fields on the form to enable/disble some buttons. Problem is that I cannot access the field values by {field}. The values are always empty. I can however make a button visible/unvisible in the method. How do I get access to the formfields? I don't want to pass every field in the procedure parameter list.

    I tried to set a field to a global using the save variable, but the fieldname assigned cannot be used in the method because it generates an error 'global variable ... not found'.

    I can however set a global and use that in the method. But then I have to create a global variable for every field and manually assign the formvalue to it???? I hope not...
    Last edited by aducom; 01-09-2013, 05:53 AM.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

  • #2
    Hi,
    could it be that you are calling your method in the OnScriptInit-Event? That would be before your SQL statement is executed. Did you try the OnLoad or the OnNavigate events?

    jsb

    Comment


    • #3
      No, I'm calling it in an ajax event. The record is displayed, then I click on a radiobutton, the event goes off and fields are empty...
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development
      www.scriptcase.eu / www.scriptcase.nl

      Comment


      • #4
        Well... I'm trying to reproduce the behaviour with no success. Is the radio button linked to a field in the table, are you using manual or automatic lookup, what event you are using (click/change...), are you doing anything else in your method but checking for values???? So many questions! :-)
        And I have the most stupid answer for you: It's working here!

        jsb

        Comment


        • #5
          I have two tabs with data. I have hidden the submitbutton. I have ajax events on radiobuttons. These radiobuttons are showing and hiding groups of data depending on it's status. In these events I call my phpmethod to check on fields if they have values and if so the submitbutton is unhidden. So the form is in input mode. If I check in the ajax event things work right. If I do so in the phpmethod then I cannot use the fieldvariables as they are empty. I have now added the fields in the parameter header of the php method which works. But I expected that the fields where accessable from the method.
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development
          www.scriptcase.eu / www.scriptcase.nl

          Comment


          • #6
            Hi,
            I tried to reproduce the error with a similar set up like yours but again it was working as expected. Sorry I can't be of any more help.

            jsb

            Comment


            • #7
              Yes, somethings things are obscure. I'll try on a test project to see how things goes. I managed by adding the {variables} to the function parameter list. But it's good to know that it should work. Thanks.
              Albert Drent
              aducom software netherlands
              scriptcase partner, reseller, support and (turn-key) development
              www.scriptcase.eu / www.scriptcase.nl

              Comment

              Working...
              X