Page 1 of 1

PostPosted: Sun Nov 26, 2006 6:08 am
by ozrebel
Hi everyone.

A quick question from a noob!

Is there a way to modify the existing add new record page to include other html tags?

I have a very large table which I want to break up with section headers so my users will more easily understand the sections they are filling out. These section headers are not part of the record structure.

Cheers

Tony

PostPosted: Mon Nov 27, 2006 2:32 pm
by shannah
You can group fields together:
http://framework.weblite.ca/documentation/manual/fields_ini/group

Other than that, you could override the new record form by overriding the new_record_form slot:

http://lamp.weblite.ca/dataface-0.6/docs/index.php?-table=SmartyTemplates&-action=browse&-cursor=19&-skip=0&-limit=30&-mode=list&-sort=Name+asc

e.g. (in your delegate class):
Code: Select all
function block__new_record_form(){
  $app =& Dataface_Application::getInstance();
  $form = df_create_new_record_form('Tablename');
 
  if ( $form->validate() ){
    $res = $form->process(array(&$form,'save'), true);
    if ( $res && !PEAR::isError($res) ){
        header('Location: '.$app->url('').'&--msg='.urlencode('Record successfully added'));
        exit;
    }
    $app->addError($res);
  }
  $form->display();
}





Note that in the above example $form is a Dataface_QuickForm object which extends HTML_QuickForm, so you can do anything with it that you can do with an HTML_QuickForm object, including applying special templates.
http://davidmintz.org/presentations/show.php/QuickForm_and_Smarty


-Steve

PostPosted: Mon Nov 27, 2006 5:38 pm
by ozrebel
Thanks for that Steve.

The grouping seems to be the way to go for me at this stage. When I've had another 6 months to better learn dataface then I might have a go at option 2 :)

I have implemented the grouping and it pretty much does what I need it to do except that it wrecks the formatting of the page.

http://www.mistro.ag/dataface/cda/index.php?-action=new&-table=cda_order

Is there a way to fix this?

I have gone through all of the fields functions in the manual and can't seem to find any reference to this problem before. Is it something that is particular to my installation, or have I missed something more basic.

Cheers

Tony

PostPosted: Mon Nov 27, 2006 6:18 pm
by shannah
Can you elaborate on the problem with the formatting. Grouping the fields will cause them to be laid out a little differently, but in my browser (Safari) your form still looks ok.

-Steve

PostPosted: Mon Nov 27, 2006 6:35 pm
by ozrebel
This is what it looks like in firefox

http://www.mistro.ag/dataface/cda/screenshot.jpg

PostPosted: Tue Nov 28, 2006 11:27 am
by shannah
I see.

I don't currently have access to a windows machine so I can't test out a fix for this (works fine on both Firefox and Safari on Mac), but perhaps you can try adding this bit of CSS to the end of the plone.css file and let me know if it makes a difference:

Code: Select all
.groupField { float: left;}


Please let me know if this works.

-Steve

PostPosted: Tue Nov 28, 2006 7:15 pm
by ozrebel
Nearly!

The fix was the following:


.groupField {
display: block;
padding-right: 1em;
float: left;
clear: both;
margin: 0.5em 0em 1em 0em;
line-height: 1.5em;
margin-bottom: 1em;
}

PostPosted: Tue Nov 28, 2006 7:55 pm
by ozrebel
Oops - spoke too soon. Not quite right there. The following seems to have got it, but it's not very elegant. Depends too much on the width I think, so it might just be a bit ugly on low resolution.


.groupField {
display: block;
width: 880px;
padding-right: 1em;
float: none;
clear: left;
margin: 0.5em 0em 1em 0em;
line-height: 1.5em;
margin-bottom: 1em;
}

PostPosted: Wed Nov 29, 2006 11:19 am
by shannah
Thanks for posting this. I'll have to look into this problem more closely to see if I can find a way to make this
work without having to set widths etc.. explicitly.

In the mean time, looks like your solution is good.

-Steve