Announcement

Collapse
No announcement yet.

javascript problem

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

  • javascript problem

    Hi, for the purpose of debugging i want to use an alert('hallo) to test if the form was submitted... so i put
    Code:
    echo "<script> alert('test'); </script>";
    in the onValidate event.... but when i submit the form just nothing happens. I also tried
    Code:
    $javascript_function  = 'alert'; // Javascript function name
    $javascript_parameters = array('hallo');
    sc_ajax_javascript($javascript_function, $javascript_parameters);
    as proposed by scriptcase but still nothing... i also put it in onLoad but still no effect.
    Am i doing something wrong ?

  • #2
    Re: javascript problem

    sc_ajax_javascript is to use when you have ajax functions ... like the events of the fields(onchange, onclick...).

    When you submit a form, the form is submitted and the php code is executed(onValidate, onValidateSeccess or Fail ...) so, you cant execute javascript on the server side. JavaScript is on the client side(browser).

    If you want to execute javascript, edit the itself.

    Form menu -> Javascript.

    Comment


    • #3
      Originally posted by diogo View Post
      sc_ajax_javascript is to use when you have ajax functions ... like the events of the fields(onchange, onclick...).

      When you submit a form, the form is submitted and the php code is executed(onValidate, onValidateSeccess or Fail ...) so, you cant execute javascript on the server side. JavaScript is on the client side(browser).

      If you want to execute javascript, edit the itself.

      Form menu -> Javascript.
      I use php to javascript option because not know another way to do it. The point is I want to run the php code, send a message to the user to
      'Accept' or 'cancel' and function of the selection of the option, php app execute one form or another grid.

      How I can do it, with your explication ??

      The code I use is as follows:


      php (OnValidate) -----

      sc_ajax_javascript ('ValidarOpcion');
      if ({field_Result == 'yes') {OpenForm}
      ...


      javascript ------

      ValidarOpcion () {
      if (confirm ('Would you like continue?')) {

      { Field_Result } = 'True';

      } Else {

      { Field_Result } = 'False';

      }
      }

      How I can do it, with your explication ?? (Form menu-> Javascript)
      thanks

      Comment

      Working...
      X