Announcement

Collapse
No announcement yet.

Adding a button to a row that runs PHP. Or, getting the selected row.

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

  • Adding a button to a row that runs PHP. Or, getting the selected row.

    Hi there-

    How can I add a button to a row in ScriptCase that is hooked to PHP code?

    Example: I have a table of users:
    user/password/Full_Name/Email

    I want a button on each row labelled "Send Welcome Email".
    When you click the button, it runs PHP code. (In this case, I'll write the PHP code to email that user.)

    How can this button be added? I'm a PHP coder, but a bit new to ScriptCase, thanks.

    Alternatively, I noticed you can select a row in a grid, but I can't see where, in the programming, I can get that selected record! If I could get that, I could just use a button on the top of the grid, although I think that's more confusing for the user.

  • #2
    You can add a new field (i.e.) link to the grid and apply code to that. Also you can create an applicationlink from the grid to the form where you can add a button (add button) and apply code.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      What do you mean add a new field?

      Here's what I did that worked:
      - Grid->Fields (folder)->New Field. Called it ClickMe. Type is Text.
      - Grid->Ajax Events->New Ajax Event. Choose the ClickMe field. Action- OnClick. Sample 1 line of code in the event: echo "ha ha!!!!! {MyField}";
      - Grid->Events->OnRecord. Add the text of the field. Code is one line: {ClickMe} = 'Click me';

      Works well and has a mouseOver.

      Still, I wish there was an easier way of doing this, as it's a pretty fundamental thing to do.

      Comment


      • #4
        Originally posted by cyman View Post
        What do you mean add a new field?

        Here's what I did that worked:
        - Grid->Fields (folder)->New Field. Called it ClickMe. Type is Text.
        This is exactly what I meant. You can put a image of a button to let it look like one. There's a sample in the SC library available to show this. Not sure, but I think it's the helpdesk app.
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          But How Can I use the parameters in ajax event?

          I try use {my_field2} and $my_field2....but I get a error, don't find the variables(parameters)

          Comment


          • #6
            I ahve the same Problem, I do not know how to access filed values in my Ajax Events =(
            According one example they said {} , but did not work.....

            Comment


            • #7
              Was an expiation of passing parameters in a grid / java event found? Same issue

              Comment


              • #8
                If you create an ajax event i.e. onchange on a field you can simply use the {} references to the form fields w.o. the need of passing them.
                Albert Drent
                aducom software netherlands
                scriptcase partner, reseller, support and (turn-key) development
                www.scriptcase.eu / www.scriptcase.nl

                Comment

                Working...
                X