1084

Not a question, but a bug report.

Comments for “Not a question, but a bug report.”
 

Posted by charlesluck59 on Saturday 19th February 2022 at 21:44 GMT

I just generated my first module, with 3 properties, and my first attempt to view the module resulted in an error.
Parse error: syntax error, unexpected 'Secondary' (T_STRING), expecting ')' in F:\xampp\htdocs\rig\modules\areacodes\controllers\Areacodes.php on line 118

That code is as follows...
 

function submit() {
$this->module('trongate_security');
$this->trongate_security->_make_sure_allowed();
$submit = post('submit', true);
if ($submit == 'Submit') {
$this->validation_helper->set_rules('primary_area_code', '"Primary Area Code"', 'required|max_length[3]|numeric|greater_than[0]|integer');
$this->validation_helper->set_rules('secondary_area_code', ' 'Secondary Area Code' ', 'required|max_length[3]|numeric|greater_than[0]|integer');
$this->validation_helper->set_rules('relation', ' 'Relation' ', 'required|min_length[1]|max_length[1]');
$result = $this->validation_helper->run();
[\code]
If you'll notice in the rules for Secondary Area Code and Relation, te inner set of quotes around the field labels should probably be double quotes. When I corrected that, it worked fine.

charlesluck59

User Level: Guest

Date Joined: 15/07/2021

Posted by charlesluck59 on Saturday 19th February 2022 at 21:58 GMT

And then... I clicked on "Create New Areacode Record" which resulted in the following...
Parse error: syntax error, unexpected 'Primary' (T_STRING), expecting ')' in F:\xampp\htdocs\rig\modules\areacodes\views\create.php on line 11.

I tried to add more info but it keeps getting cut off.
Let us not judge others for being less than perfect.

On the manage page, "" tags do not require quotes around the labels.
It's starting to look that like someone coded up a function to handle the quotes, and that module needs some TLC.

This comment was edited by charlesluck59 on Saturday 19th February 2022 at 22:12 GMT

charlesluck59

User Level: Guest

Date Joined: 15/07/2021

Posted by djnordeen on Sunday 20th February 2022 at 14:11 GMT

Hello Charles,

Can you post lines 117 to 119 in your controller file?

I believe that you have to many quotes.
There should just be single quotes.
Not 2 pairs of single quotes or double quotes.

Dan

This comment was edited by djnordeen on Sunday 20th February 2022 at 14:12 GMT

Early Adopter

djnordeen

User Level: Early Adopter

Date Joined: 20/08/2021

Posted by DaFa on Monday 21st February 2022 at 01:22 GMT

Hi Charles, welcome back.

I've never seen the Desktop App produce code like that before and I've created loads of apps using it.

If you could reproduce it in a video, I'd be interested to see it.

Obviously, the code you have in your controller has syntax errors:
$this->validation_helper->set_rules('primary_area_code', '"Primary Area Code"', 'required|max_length[3]|numeric|greater_than[0]|integer');
$this->validation_helper->set_rules('secondary_area_code', ' 'Secondary Area Code' ', 'required|max_length[3]|numeric|greater_than[0]|integer');
$this->validation_helper->set_rules('relation', ' 'Relation' ', 'required|min_length[1]|max_length[1]');

1. The first validation rule is OK with the single wrapping the double quotes, but the double quotes are not necessary
2. The next 2 validation rules have syntax errors
It should read as follows:
$this->validation_helper->set_rules('primary_area_code', 'Primary Area Code', 'required|max_length[3]|numeric|greater_than[0]|integer');
$this->validation_helper->set_rules('secondary_area_code', 'Secondary Area Code', 'required|max_length[3]|numeric|greater_than[0]|integer');
$this->validation_helper->set_rules('relation', 'Relation', 'required|min_length[1]|max_length[1]');


Can I ask what text editor you are using, as the errors would be made obvious in something like VS Code or Sublime Text?
Founding Member

DaFa

User Level: Founding Member

Date Joined: 30/11/2018

Posted by charlesluck59 on Saturday 16th April 2022 at 20:37 GMT

I have no idea how to close a thread.
I had to reduce my screen down to 67% to see the right side of the content.
I didn't even know you could pick a winning response.

charlesluck59

User Level: Guest

Date Joined: 15/07/2021

Posted by djnordeen on Sunday 17th April 2022 at 00:30 GMT

That's ok. Thanks for checking back to close it out.
Mobile devices do not keep the responses between the lines.
Dan
Early Adopter

djnordeen

User Level: Early Adopter

Date Joined: 20/08/2021

×