Custom add page

A place for users and developers of the Xataface to discuss and receive support.

Postby ozrebel » Sun Nov 26, 2006 6:08 am

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
ozrebel
 
Posts: 18
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Mon Nov 27, 2006 2:32 pm

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ozrebel » Mon Nov 27, 2006 5:38 pm

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
ozrebel
 
Posts: 18
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Mon Nov 27, 2006 6:18 pm

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ozrebel » Mon Nov 27, 2006 6:35 pm

This is what it looks like in firefox

http://www.mistro.ag/dataface/cda/screenshot.jpg
ozrebel
 
Posts: 18
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Nov 28, 2006 11:27 am

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ozrebel » Tue Nov 28, 2006 7:15 pm

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;
}
ozrebel
 
Posts: 18
Joined: Wed Dec 31, 1969 5:00 pm

Postby ozrebel » Tue Nov 28, 2006 7:55 pm

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;
}
ozrebel
 
Posts: 18
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Nov 29, 2006 11:19 am

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 31 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved