Page 1 of 1

bug adding/deleting ids from begining of form field names?

Posted: Wed Jul 16, 2008 9:29 am
by kazkas
That's the first time it is happened to me and I think is not such common thing, but:

1. I created hidden field with

Code: Select all

$this->smarty->assign('id1', $this->CreateInputHidden($id, 'id1', 1));
2. Checked generated page with FF, it has

Code: Select all

<input type="hidden" name="1id1" value="1" />
- everything is great so far, 1 is added to beginning of all field names in the form, as usual.

3. Did print_r ($params) in target file and got ['id']=1, not ['id1']!

4. Changed line from

Code: Select all

$this->smarty->assign('id1', $this->CreateInputHidden($id, 'id1', 1));
to

Code: Select all

$this->smarty->assign('id1', $this->CreateInputHidden($id, 'id2', 1));
- now everything works fine, I have $params['id2'] now, not $params['id'] like in first time!

5. Next step - created

Code: Select all

$this->smarty->assign('id1', $this->CreateInputHidden($id, 'i1111d2', 1));
, got

Code: Select all

<input type="hidden" name="1i1111d2" value="1" />
in HTML and guess what? $params showed [id2]=>1 after submitting form!

Logic says, that there is a bug in routine that generates $params variable, deleting "1" (or whatever was added in the beginning of form fields) not only from beginning, but from all field name. Am I right?

Re: bug adding/deleting ids from begining of form field names?

Posted: Thu Jul 17, 2008 10:08 am
by irish
It's possible that you can't have 'id' in as a input field name or any combination of 'id'. It seems there are some reserved words that can't be used as form fields. I found having a form field name of 'action' will throw errors.

So basically try renaming the hidden field to something different.

Re: bug adding/deleting ids from begining of form field names?

Posted: Wed Aug 13, 2008 2:06 pm
by kazkas
yeh, I did that, and it worked. Just made a point for developers, that this part should be redone better in CMS MS