Title: datagrid calls form: how to pass id paramater Post by: andyj on July 30, 2013, 02:12:13 AM I want to call a form to edit a single record from a datagrid containing many records.
The edit form's datasource (data_select.php) dynamically queries a MySQL table to create a json file. It needs to receive the id key parameter. e.g. data_select.php?entity_id=3 (where 3 is the parameter value being passed) Code: <?php The calling datagrid uses this function to open the edit form: Code: function openForm(){ The edit form itself has its datasource definition like this: Code: $('#fm1').form('load','data_select.php?entity_id='+request.getParameter("entity_id")); Can anyone help please? Thanks in advance :-\ Title: Re: datagrid calls form: how to pass id paramater Post by: stworthy on July 30, 2013, 06:45:32 PM Some syntax errors occur in your statement:
Code: $('#fm1').form('load','data_select.php?entity_id='+request.getParameter("entity_id")); Code: $('#fm1').form('load','data_select.php?entity_id='+'<?php echo $eid;?>'); Title: Re: datagrid calls form: how to pass id paramater Post by: andyj on July 31, 2013, 01:33:16 AM Unfortunately that didn't do the trick.
Code: $('#fm1').form('load','data_select.php?entity_id='+'<?php echo $eid;?>'); View Source shows a blank value, e.g. "supplieredit.php?entity_id=" The order of events is
My only thoughts on why it is not working are: May be the edit form's "load" method is firing before the url parameter is available to it? Should I use the form's onBeforeLoad method to get the variable? Is there any tutorial on how to pass variables via url parameters? I guess I could use php session variables but it would be nice to be able to manipulate url parameters. Thanks for your input, greatly appreciated. Title: Re: datagrid calls form: how to pass id paramater Post by: andyj on July 31, 2013, 01:45:42 AM Got it now.
It should be: Code: $('#fm1').form('load','data_select.php?entity_id='+'<?php echo $_GET['entity_id'];?>'); Thanks for putting me on the right track. |