RE: [fw-general] Ajax Forms

2009-05-29 Thread Anthony Smith
Let's say I have a form that has a drop down of two choices. If you pick
choice 1) then the screen should show you another drop down and a text
box. If I pick choice 2) the screen should show 2 additional drop downs
and two text boxes. 

 

I have no problem using either. I ran into some trouble using Dojo with
onSubmit, but I am open to the possibility. 



From: Vadim Gabriel [mailto:vadim...@gmail.com] 
Sent: Friday, May 29, 2009 03:29 AM
To: 411161
Cc: fw-general@lists.zend.com
Subject: Re: [fw-general] Ajax  Forms

 

Hi,

Not sure if i follow your problem. But why won't you use Dojo? or Jquery
which are included. 

On Thu, May 28, 2009 at 11:48 PM, 411161 411...@fedex.com wrote:


I am not using Zend_Form, bu if I have to I will. I basically have a
page
that is a form. When a user selects certain options from the form more
of
the form appears and in some cases part of the form dis-appears.
Currently,
I use onChange and just refresh the page. I found a way to integrate
Prototype, but I am still not integrated it fully, because what happens
is
the onChange is called view Prototype and it calls an action in my
controller and variables are set, but for they are set for the action
called
by ajax.


--
View this message in context:
http://www.nabble.com/Ajax---Forms-tp23769817p23769817.html
Sent from the Zend Framework mailing list archive at Nabble.com.




-- 
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.
Zend Framework Certified Engineer.
-- http://www.vadimg.co.il/






RE: [fw-general] what can be used t replace these nice smarty features

2009-05-20 Thread Anthony Smith
Perfect!

-Original Message-
From: Tobias Gies [mailto:tobiasg...@googlemail.com] 
Sent: Tuesday, May 19, 2009 03:56 PM
To: 411161
Cc: fw-general@lists.zend.com
Subject: Re: [fw-general] what can be used t replace these nice smarty features

Hi,

you can either use the form* family of view helpers (more at
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial)
if you already have your custom form processing logic in place, or you
can use Zend_Form
(http://framework.zend.com/manual/en/zend.form.html), which will take
over a lot of the forms processing work for you.

HTH.

Best regards,
Tobias

2009/5/19 411161 411...@fedex.com:

 I have decided not to use Smarty as my template engine. But, what can I use
 instead in Zend View for things like: html_options

 I despise too many loops in my pages and this was a very clean way to
 populate a dropdown.

 select size=1 name=shortTerritory onchange=form1.submit()
        {html_options options=$shortTerritories selected=$selected_fiscal_year}
 /select


 What are my alternatives? Another reason why I am leaving Smarty is because
 I could not get it to integrate with Dojo.
 --
 View this message in context: 
 http://www.nabble.com/what-can-be-used-t-replace-these-nice-smarty-features-tp23623976p23623976.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




RE: [fw-general] How to set up dependant dropdowns in form

2009-04-28 Thread Anthony Smith
Thanks Brad.

 

Now I had one other question. Let's say my data looks like this:

{identifier:TERRITORY,items:[

{SUB:8-8-19-6,TERRITORY:8-8-19-66-1-3-25},

{SUB:8-8-19-6,TERRITORY:8-8-19-66-1-2-24}, ..

 

Instead of this:

{identifier:name,items:[

{name:0,0:Lion},

{name:1,0:Cheeta},

{name:2,0:Cat}, ...

 

 

I want to USE the SUB values to get the values for the TERRITORY. How do
I do that? 



From: Bart McLeod [mailto:mcl...@spaceweb.nl] 
Sent: Monday, April 27, 2009 11:22 AM
To: 411161
Cc: fw-general@lists.zend.com
Subject: Re: [fw-general] How to set up dependant dropdowns in form

 

You should be using dojo selects in the first place, I have a working
example (4files):
file index.phtml (in scripts/ directory)
?php echo $this-doctype() ?
html
head
?php echo $this-headTitle() ? 
?php echo $this-headMeta() ? 
?php echo $this-headLink() ? 
?php echo $this-headStyle() ? 
?php 

$this-dojo()-setLocalPath('/zf/js/dojo/dojo.js')
 -addStyleSheetModule('dijit.themes.tundra');
echo $this-dojo()-enable();
echo $this-headScript();
?

/head
body class=tundra
?php echo $this-form ?
?php echo $this-inlineScript() ?
/body
/html

//following files in root directory
file index.php:

?php
require_once 'autoload.php';
$view = new Zend_View();
Zend_Dojo::enableView($view);

$form = new Zend_Dojo_Form('myform');
$form-setView($view);

$autoComplete1 = new Zend_Dojo_Form_Element_FilteringSelect('sel_1');
//$autoComplete1 = new Zend_Form_Element_Select('sel_1');
$autoComplete1-setMultiOptions(
array('Cats', 'Dogs')
);
$autoComplete1-setAttrib('onchange', dijit.byId('sel_2').searchAttr =
dijit.byId('sel_1').getValue();return true);
$autoComplete1-setLabel('Select 1');
$form-addElement($autoComplete1);
$searchAttribute = @$_GET['sel_1'];
if( ! in_array($searchAttribute, array('0', '1'))){
$searchAttribute = '0';
}
$form-addElement(
'FilteringSelect',
'sel_2',
 array(
 'label' = 'Select 2',
 'storeId' = 'myData',
 'storeType'= 'dojo.data.ItemFileReadStore',
 'storeParams' = array( 'url' = '/zf/dojo.php',),
 'dijitParams' = array( 'searchAttr' = $searchAttribute,
),
 )
);
$form-addElement('submit','go');
$form-populate($_GET);
$view-form = $form-render();
$view-addBasePath('E:\werk\zf fixes\testsite');
echo $view-render('index.phtml');

?

file dojo.php:
?php
require_once 'autoload.php';

$data = new Zend_Dojo_Data();
$data-setIdentifier('name');

$cats = array('Lion', 'Cheeta', 'Cat');

foreach ($cats as $key = $cat) {
$data-addItem(array('name' = $key, '0' = $cat));
}

$dogs = array(3 = 'Bello', 4 = 'Blix', 5 = 'Freddy', 6 = 'Hungry
Bill');
foreach ($dogs as $key = $dog) {
$data-addItem(array('name' = $key,1 = $dog));
}

echo $data;

file autoload.php: (depecated)
?php

require_once 'Zend/Loader.php';
/**
 * Loads all Zend Framework classes automagically
 *
 * @param string $className
 */
function __autoload($className){
Zend_Loader::loadClass($className);
}

?

Hope this helps,

Bart

411161 schreef: 

 
 
Ace Paul wrote:
  

I have a form, which I would like to use dependent drop downs
in. I can't
seem to find anything about it hear, after looking all morning
trying to
work it out.
I have one field race_country
when an option is selected I would like to show the cities in
that
country.
The following is what I have currently in the form, which will
show all
countries and all cities.
Any help would be great. thanks
 
$table = new Country();
foreach ($table-fetchAll() as $c) {
$country-addMultiOption($c-country_id, $c-country_name);
}
 $this-addElement( $country);
  
 $city = new Zend_Form_Element_Select('race_city');
$city-setLabel('City')
 -setRequired(true);
 
$table = new City();
foreach ($table-fetchAll() as $c) {
$city-addMultiOption($c-city_id, $c-city_name);
}
 $this-addElement( $city);
 


 
Does anyone have a complete example of this?
 
I used this example to get it up and going:
http://techchorus.net/autocomplete-example-zenddojoformelementfilterings
elect-and-zenddojodata
 
With the change located in the comments:
div dojoType=dojo.data.ItemFileReadStore url=/strain/list
jsId=strainStore/div
 
but I am having trouble trying to do dependent drop downs. Any good
references out there, or is this too early to attempt with Zend   Dojo?