Manually choose which attributes to edit

Author Message

Roy Bøhmer

Thursday 29 July 2004 2:06:23 am

Hi!
Lets say I've made a class with 2 attributes: name (textline) and email (email). The email-attribute is required.
Now I want anonymous users to make new objects of this class. This is no problem when using code like

{include uri="design:content/edit_attribute.tpl"}

But how do I write the code if I only want the useres to fill in ONLY the email-attribute? In other words: I dont want them to be presented to a textline where they have to fill in their name.
I've tried to find the golden documentation page on how to make the form manually, but with no luck.

The html-output is something like

<input type="hidden" name="ContentObjectAttribute_id[]" value="785" />
<input class="" type="text" size="40"  name="ContentObjectAttribute_ezstring_data_text_785" value=""  />

and I think the name="..." is my problem. But how to make it dynamic?

Thanks!
Roy

Paul Forsyth

Thursday 29 July 2004 2:47:38 am

Try this:

If you are editing something then the varaible $content_attributes will be. You need to select the correct attribute to make this work...

<form>
{let email_attribute=$content_attributes[1]}

{attribute_edit_gui attribute=$email_attribute}
<input type="hidden" name="ContentObjectAttribute_id[]" value="{$email_attribute.id}" />

<input type="submit" name="PublishButton" />
<input type="submit" name="CancelButton" />

{/let}

</form>

Hope this helps

paul

--
http://www.visionwt.com

Roy Bøhmer

Thursday 29 July 2004 5:52:30 am

Aaah! Thanks! Things are getting clearer.
But this means the user has to press some kind of Edit or New-button first. I would like to have the form present all the time, much like the search-form (even if my first post didn't tell). The intention is to make it easy for people to subscribe to a newsletter. But if my "clear" understanding is right I have to make a content/edit-call before I will be able to publish new objects, or..?

Roy

Paul Forsyth

Thursday 29 July 2004 6:01:37 am

If you are creating new objects a call to content/edit is the best way to go. If you are making any kind of form submit you always need a way of making the form submit, so buttons (of whatever form) are needed :)

It sounds like you want something like kernel/content/tipafriend.php. Have a look at how this code works, passes information from the html to the php underneath. Objects can then be created as you need.

paul

Roy Bøhmer

Thursday 29 July 2004 6:51:57 am

Thank you. I'll look into the tip-a-friend stuff soon. I've also made a module in order to send SMS, so I might just do some adjustments to make it create new objects. Wonder why I didnt think about doint it in php before. Well, I'll blame it on the fact that everybody else is on vacation and I still sit here :-)

Brendan Pike

Sunday 31 October 2004 7:09:17 pm

I'm quite interested to know what you created regarding the SMS module. I'm wondering if anyone has created a workflow extension to SMS as well as email when triggered.

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 06:30:04
Script start
Timing: Jan 19 2025 06:30:04
Module start 'layout'
Timing: Jan 19 2025 06:30:04
Module start 'content'
Timing: Jan 19 2025 06:30:05
Module end 'content'
Timing: Jan 19 2025 06:30:05
Script end

Main resources:

Total runtime1.4452 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 590.4063152.6406
Module start 'layout' 0.00640.0039 743.046939.4766
Module start 'content' 0.01031.4337 782.5234570.8750
Module end 'content' 1.44390.0012 1,353.398416.1250
Script end 1.4452  1,369.5234 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.2089160.0002
Check MTime0.00130.0881160.0001
Mysql Total
Database connection0.00070.051210.0007
Mysqli_queries1.389696.1558680.0204
Looping result0.00070.0481660.0000
Template Total1.407597.420.7038
Template load0.00220.150920.0011
Template processing1.405397.242420.7027
Template load and register function0.00020.015710.0002
states
state_id_array0.00090.065010.0009
state_identifier_array0.00070.049120.0004
Override
Cache load0.00180.1268340.0001
Sytem overhead
Fetch class attribute can translate value0.00040.027430.0001
Fetch class attribute name0.00100.071860.0002
XML
Image XML parsing0.00030.022730.0001
class_abstraction
Instantiating content class attribute0.00000.001060.0000
General
dbfile0.00190.1332100.0002
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 27
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs