conditional field attribute

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

conditional field attribute

Postby Kriss » Fri Aug 05, 2011 6:52 pm

Hello,
I'm a newbie with Xataface and PHP.
I have a form with two fields FieldA and FieldB.
I would like to change the attribute of FieldB (regex format) depending on the value of the FieldA.
How can i do that ?
Thanks for the response.
Kriss
 
Posts: 5
Joined: Fri Aug 05, 2011 6:29 pm

Re: conditional field attribute

Postby shannah » Sat Aug 06, 2011 5:08 pm

If you want to do it on save, then you can use the beforeSave() trigger in the delegate class.
If you want to do it client side you could attach some javascript to your fields.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: conditional field attribute

Postby Kriss » Wed Aug 17, 2011 5:00 am

Hello Shannah,
I tried to install a javascript onchange event handler to a field as you explain in "How to include custom javascripts and stylesheets in your application".
I created an ApplicationDelegate.php file in the directory my_application/conf which contents
function block__custom_javascripts(){
echo '<script src="javascripts.js" type="text/javascript" language="javascript"></script>';
}

But when I refresh the site's page, I got a blank page with function block__custom_javascripts(){ echo ''; } print on the first line.
What's the error I made ?
Thanks
Kriss
 
Posts: 5
Joined: Fri Aug 05, 2011 6:29 pm

Re: conditional field attribute

Postby shannah » Wed Aug 17, 2011 7:10 am

The app delegate class needs to be a php class. You are missing the php open tags and the class declaration. Read up on delegate classes and the application delegate class for more details and examples.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: conditional field attribute

Postby Kriss » Thu Aug 25, 2011 9:16 pm

Thank you Steeve for DF and your quick answers.
I succeeded to do a javascript onchange event handler !
I'm less and less a newbie !
But I think, i'll be back later for some news questions.
Kriss
 
Posts: 5
Joined: Fri Aug 05, 2011 6:29 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 12 guests

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