Hi, I'm newbie on chronoforms and i want to get data from a url with a result like {"Number":"1020","Description":"SOCKS"}
I want to get "Description" data and put the value in a text box.
is it possible? I'm trying with
<?php
$result = //my url;
$table = json_decode($result, true);
but nothing works
can anyone help me??
Thanks
I want to get "Description" data and put the value in a text box.
is it possible? I'm trying with
<?php
$result = //my url;
$table = json_decode($result, true);
but nothing works
can anyone help me??
Thanks
Hello palacietes,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
My form data isn't saving to the database correctly
My CFv5 form data isn't saving to the database correctly
How do I save form data to a database table?
How to load record data from a database table into your form
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
My form data isn't saving to the database correctly
My CFv5 form data isn't saving to the database correctly
How do I save form data to a database table?
How to load record data from a database table into your form
P.S: I'm just an automated service😉
Hi palacietes,
Please add a Custom Code action in the On Load event (if the data is in the page URL) and add code like this
It's not clear to me where the json data comes from though?
Bob
Please add a Custom Code action in the On Load event (if the data is in the page URL) and add code like this
<?php
$form->data['json'] = json_decode($form->data['param_name'], true);
?>
then the decription should be in $form->data['json']['Descriptiom']
It's not clear to me where the json data comes from though?
Bob
Thank Bob for your reply. The data is in other server, i want to get it through JSON.
In the On Load event i have this code:
Now, how can i get this data in a text field?
I don't know where i must put this code to get field "Description":
$form->data['Description'], true;
Thanks
In the On Load event i have this code:
<?php
$result = http://server:8080/Api/Product/1020;
$table = json_decode($result, true);
?>
Now, how can i get this data in a text field?
I don't know where i must put this code to get field "Description":
$form->data['Description'], true;
Thanks
Hi palcietes,
I'm pretty sure that your code won't work - this line isn't good PHP
You can add echo $result; to test what output you are getting.
Bob
I'm pretty sure that your code won't work - this line isn't good PHP
$result = http://server:8080/Api/Product/1020;
When you have got that working correctly we can see what needs to be done with the result.
You can add echo $result; to test what output you are getting.
Bob
Hi, I forgot put the quotes, but it still doesn't work.
$result = "http://server:8080/Api/Product/1020";
If I try in a browser I get the string:
{"Number":"1020","Description":"SOCKS"}
I've tried demo-dynamic-dropdown sample with echo but I have the same result, the combo target doesn't get any data
Regards
$result = "http://server:8080/Api/Product/1020";
If I try in a browser I get the string:
{"Number":"1020","Description":"SOCKS"}
I've tried demo-dynamic-dropdown sample with echo but I have the same result, the combo target doesn't get any data
Regards
Hi palacietes,
Then please try this version of the code I posted earlier:
Bob
Then please try this version of the code I posted earlier:
<?php
$result = 'http://server:8080/Api/Product/1020';
$form->data['json'] = json_decode($result, true);
?>
Bob
Hi, finally I get the data with this code in Form Code, outside of events:
However, I don't know how to put the data in a text field when a button is pushed
Thanks again
<?php
$result = 'http://server:8080/Api/Product/1020';
$obj = json_decode(file_get_contents($result), true);
echo $obj['Description'];
?>
However, I don't know how to put the data in a text field when a button is pushed
Thanks again
Hi palacietes,
When what button gets pushed? Where is this button exactly and what needs to happen when it is clicked?
Bob
When what button gets pushed? Where is this button exactly and what needs to happen when it is clicked?
Bob
When I push a form button I need to check the item number and put the item description in a text field. This button isn't a Submit button, Submit button is used to write to DB.
Regards
Regards
I forgot to comment the item number is in a text field and when the button is pushed I check the number in the url to get its description
This topic is locked and no more replies can be posted.