EasyUI Forum
September 14, 2025, 03:49:54 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Form not loading via URL  (Read 5776 times)
toates
Newbie
*
Posts: 2


View Profile Email
« on: June 04, 2015, 04:29:53 AM »

When using the following code to load a form with data it works just fine:

               $('#'+formType+'dlg').dialog('open').dialog('setTitle','Update');
               $('#'+formType+'fm').form('load',{CONTROL_ID:522,CONTROL_NAME:'Test'});
               $('#'+formType+'fm').form('validate');

When I code the following to use a URL to load the form, the URL which returns the exact same string, the form fails to load with data:

               $('#'+formType+'dlg').dialog('open').dialog('setTitle','Update');
               $('#'+formType+'fm').form('load','Control_SelectDirect.php');
               $('#'+formType+'fm').form('validate');

Here is the contents of the URL file 'Control_SelectDirect.php'

               <?php
               print "{CONTROL_ID:522,CONTROL_NAME:'Test'}";
               ?>

The way I read the documentation I should be able to use a URL to load a form, correct? What am I doing wrong?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: June 04, 2015, 06:55:04 AM »

Please try
Code:
<?php
echo "{\"CONTROL_ID\":522,\"CONTROL_NAME\":\"Test\"}";
?>


or

Code:
<?php
$a 
= array();
$a['CONTROL_ID'] = 522;
$a['CONTROL_NAME'] = 'Test';
echo 
json_encode($a);
?>

Logged
toates
Newbie
*
Posts: 2


View Profile Email
« Reply #2 on: June 04, 2015, 07:45:56 AM »

That worked. However that was just a stub dynamic php to resolve the real problem of my dynamic php select url not populating the form. A little more investigation showed that the JSON result set was returning a set

     [{CONTROL_ID:522,CONTROL_NAME:'Test'}]

with brackets included when the form was expecting just a single item.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!