Multi-item editing gives troubles with field ids

Are You Lost In The CMS Features, Let Us Help You To Undestand How To Use Them.

Multi-item editing gives troubles with field ids

Postby shershen » Sun Jun 20, 2010 10:39 pm

in an entry, you've got working with fields like this
Code: Select all
$_POST['pages'][$id]['title] = $title;
  $_POST['pages'][$id]['pages_author'] = $author;

i mean there are arrays of ids and names of fields, that a named like "pages[80][title]", "pages[80][pages_author]" (80 - it's and example id) and so on
and because of this i can not use them in any JavaScript code for inserting a value like :
Code: Select all
document.forms[0].ITEMID.value = ...

because all ITEMIDs contain several "[" and "]"...
is there any possibility to contact fileds with such names by a JS or to rewrite a code
not to use this kind of naming fileds
shershen
Member Neptune
Member Neptune
 
Posts: 1
Joined: Sun Jun 20, 2010 10:28 pm

Re: Multiitem editing gives troubles with field ids

Postby dbashyal » Mon Jun 21, 2010 7:49 am

You can change IDs to string from array, so there won't be issue with JS selector.
Before:
Code: Select all
<input class="txtFld" name="pages[<?php echo $k; ?>][pages_title]" type="text" id="pages[<?php echo $k; ?>][pages_title]" value="<?php echo $v['pages_title']; ?>" />

After:
Code: Select all
<input class="txtFld" name="pages[<?php echo $k; ?>][pages_title]" type="text" id="pages_<?php echo $k; ?>_pages_title" value="<?php echo $v['pages_title']; ?>" />


I'll keep this in mind for next release. Let me know if this solves your issue.
Download Free PHP CodeIgniter CMS 'Codefight CMS': http://codefight.org
dbashyal
Site Admin
 
Posts: 38
Joined: Mon May 21, 2007 10:35 pm

Re: Multiitem editing gives troubles with field ids

Postby chaleswa » Mon Jun 28, 2010 11:30 pm

Hi,
I was indeed in a similar situation like this and I used java script code to create temporary form and send the data as expected by the php. since I don't want to change the php code which was already working properly. thanks very much for the information.

Thank you!
chaleswa
Member Uranus
Member Uranus
 
Posts: 10
Joined: Thu Apr 01, 2010 5:57 pm

Re: Multi-item editing gives troubles with field ids

Postby dbashyal » Wed Jul 28, 2010 9:26 am

If you already didn't know, the new version was out few days ago.
Download Free PHP CodeIgniter CMS 'Codefight CMS': http://codefight.org
dbashyal
Site Admin
 
Posts: 38
Joined: Mon May 21, 2007 10:35 pm


Return to How tos?

Who is online

Users browsing this forum: No registered users and 2 guests

cron