No announcement yet.


  • Filter
  • Time
  • Show
Clear All
new posts

  • Confused!!!!!

    I have a control application with several fields. When the user clicks on the Ok button I created, it executes a SQL statements and places the results in HTML output in the form of a table. It also creates a global array of the results for use on another form.

    One of the columns is a button that opens up a SC created form and it has a URL parameter to go with it. The URL is generated using the sc_make_link function. It's here is where I get confused...

    When the form is loaded (from the button), there is logic in the onApplicationInit event to; 1)sc_apl_conf("form_external_customer_reservation" ,"start","new"); and 2) take the URL parameter and get the array line with the data created from the control. The fields are stored in global variables. In the onLoad event, the form fields are loaded from those global variables. When I look at the fields (all of them are select boxes) the values they display are correct matching what was taken from the array. All of these fields are marked as disabled as they were already loaded when the application started. When I hit the add button after filling out some other required fields, the form validation fails on the fields that were loaded when the application started saying that required fields are missing yet it shows data in the those fields.

    Any ideas? Am I using the wrong event(s) - although I have tried many different combinations of events but nothing seems to resolve the validation errors I'm getting?

    Button URL:

    sc_apl_conf("form_external_customer_reservation"," start","new");

    [local_idsite] = [res_array][$_GET["pres_array"]][0];
    [local_iddock] = [res_array][$_GET["pres_array"]][1];
    [local_arrival_date] = [res_array][$_GET["pres_array"]][2];
    [local_arrival_time] = [res_array][$_GET["pres_array"]][3];
    [local_departure_date] = [res_array][$_GET["pres_array"]][4];
    [local_departure_time] = [res_array][$_GET["pres_array"]][5];
    [local_vessel_loa] = [res_array][$_GET["pres_array"]][6];
    [local_vessel_beam] = [res_array][$_GET["pres_array"]][7];
    [local_vessel_draft] = [res_array][$_GET["pres_array"]][8];

    {idsite} = [local_idsite];
    {iddock} = [local_iddock];
    {arrival_date} = [local_arrival_date];
    {arrival_time} = [local_arrival_time];
    {departure_date} = [local_departure_date];
    {departure_time} = [local_departure_time];
    {vessel_loa} = [local_vessel_loa];
    {vessel_beam} = [local_vessel_beam];
    {vessel_draft} = [local_vessel_draft];

    * Checking the difference between due date to current date.

    $numofdays = sc_date_dif({departure_date}, 'aaaa-mm-dd', {arrival_date}, 'aaaa-mm-dd');

    * Selecting a field from another table

    // Check for record
    $check_sql = "SELECT rate_amount"
    . " FROM rate r, site s"
    . " WHERE s.idsite = " . {idsite} . " AND r.idrate = s.site_default_rate";
    sc_lookup(rs, $check_sql);

    if (isset({rs[0][0]})) // Row found
    $defaultrate = {rs[0][0]};
    {idrate} = $defaultrate;
    {total_due} = round(($defaultrate * {vessel_loa}) * $numofdays, 2);

    Validation error fields:
    idsite, vessel_loa, vessel_beam, vessel_draft

  • #2
    Go to application => global variables and switch in/out type. Then the error should disappear
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development /


    • #3
      Had them set as out and switched them all to in. Same validation errors...


      • #4
        Just some additional information.

        I echo the 4 fields failing validation (in the onValidate event) and the results are blank yet when I close the error box, the values in those fields are still showing as correct (exactly what was passedin the array and set when the application started). So somewhere the values are being lost during the validation process. Also I'm using google chrome so I can "inspect" the HTML. When I look into the select option on each field in error, it shows all of the possible values retrieved from the database and the correct one shows as "Selected". Even more mysterious...