Forum for discussing general topics related to Couch.
30 posts Page 2 of 3
Bartonsweb wrote: I was hoping you'd try yourself, but here you go - try this:

users-admin.php

Code: Select all
<?php require_once( '../admin/cms.php' ); ?>
<cms:template title='User Cours Admin' hidden='0' />

<cms:pages masterpage=k_user_template page_id=k_user_id >
<tr>
<th scope="row"><cms:show employee_id /></th>
<td><a href="users-cours-admin-edit.php?id=<cms:show k_page_id />"><cms:show fullname /></a></td>
</tr>
</cms:pages>

<?php COUCH::invoke(); ?>


users-admin-edit.php

Code: Select all
<?php require_once( '../admin/cms.php' ); ?>
<cms:template title='Cours Edit' hidden='0' order='13' />
<cms:set edit_user="<cms:gpc 'id' />" />
<cms:set success_msg="<cms:get_flash 'success_msg' />" />
<cms:if success_msg >
<h2> - Endringer ble lagret velykket!</h2>
</cms:if>

<cms:form
masterpage=k_user_template
mode='edit'
page_id=edit_user
enctype="multipart/form-data"
method='post'
anchor='0'
>

<cms:if k_success >
<cms:db_persist_form />

<cms:if k_success >
<cms:set_flash name='success_msg' value='1' />
<cms:redirect k_page_link />
</cms:if>
</cms:if>

<cms:if k_error >
<font color='red'><cms:each k_error ><cms:show item /><br /></cms:each></font>
</cms:if>

<td>
<cms:input name='fullname' type='bound' class="form-control col-md-10 col-xs-12"/
</td>

<input type="submit" name="submit" value="Save" class="btn btn-primary"/>

</cms:form>


Ah, now i understand. I forgott about the ?= in the link. Im so truly glad for your help. THANKS ALOT :) Now everything works perfect.

I think i must read the Documentation one more time so i realy understand everything.
Sorry to bother you again, but i forgott to test and Save, and when i click the Save now i get

ERROR: Tag "form" - page_id required

I tryed to put the ID but cant figuer it out.!

Any ideas?
are you using page_id=edit_user on the form?
Image
Bartonsweb wrote: are you using page_id=edit_user on the form?


<cms:form
masterpage=k_user_template
mode='edit'
page_id=edit_user
nctype="multipart/form-data"
method='post'
anchor='0'
>

YES

And this in top under <cms:template></cms:template>

<cms:set edit_user="<cms:gpc 'id' />" />
Hi,

Try
Code: Select all
page_id="<cms:show edit_user/>"
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
and you're accessing this template via the link given in the list of users? if you access the url without the ?id= parameter I imagine the form will error. You can overcome this with some if statements to check if the parameter was set and fall-back to the logged in users ID if it is not.
Image
Tomarnst wrote: Hi,

Try
Code: Select all
page_id="<cms:show edit_user/>"


Sorry, that does not work!
maybe this

Code: Select all
<cms:set edit_user="<cms:gpc 'id' /> "  'global' />


Otherwise I would check if you get the correct value in edit_user by using <cms:show edit_user/> somewhere in your file

I looked into my own files that has the same way of working and this should work
Code: Select all
<cms:set edit_user = "<cms:gpc method='get' var='id'/>" 'global'/>
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
Hi,

Thanks for all the help, but im still having the problem! I tryed all the different variants but none of them is working.
Hello again,

do you get the correct value when using <cms:show edit_user/> in your form file ?

let say you want to edit user with id 13 and you don't get 13 if you use <cms:show edit_user/> in your form, then the url isn't working.

You could try

Code: Select all
<a href="<cms:add_querystring link="<cms:link 'users-cours-admin-edit.php'/>" querystring="id=<cms:show k_page_id" />" ><cms:show fullname /></a>
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
30 posts Page 2 of 3
cron