| View previous topic :: View next topic |
| Author |
Message |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Thu Jul 20, 2006 10:01 am Post subject: |
|
|
Hi,
Sorry for the delayed response. What you would need to do is create a javascript function for this. I'm sure google has some copy/paste code you can use. It will probably require that you set this to the onKeyDown and/or onKeyUp event for the text box. In which case for your text box you would add a 3rd argument. Something like:
| Code: |
$_cal_form->textbox('myfield', 32,
"onKeyUp='only_numbers()' onKeyDown='only_numbers()'"); |
Where 'only_numbers()' is the javascript function you added. This function would go at the bottom of include/templates/event_edit_tpl.php.
Let me know if you have any more questions. |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Jul 29, 2006 8:44 pm Post subject: |
|
|
Hi...
Everything works nicely after having set my categories list box in the Event Edit form to trigger the hiding/showing of different custom fields i created.
The only thing i have left is that i want all my custom fields to be hidden when the "(None)" row is selected in the categories drop down.
So i added that in the Javascript function that is triggered when the select box changes and it works, but only when "(none)" is manually selected in the dropdown. I want that piece of code in that function to be executed to start with when the form is first displayed.
So where i had:
| Code: |
$_cal_form->select("type", array('('._NONE_.')') + $_cal_event->cal_etypes, "' onChange='upd_custfields()'") ."");
|
i tried this:
| Code: |
$_cal_form->select("type", array('('._NONE_.')') + $_cal_event->cal_etypes, " onLoad='upd_custfields()' onChange='upd_custfields()'") ."");
|
But it doesn't work i think the onLoad is not for that, any hints on how to accomplish this? I suspect it must be something easy.
Thanks for any help,
NiCo |
|
| Back to top |
|
 |
smeallum
Joined: 17 May 2006 Posts: 177
|
Posted: Sat Jul 29, 2006 8:45 pm Post subject: |
|
|
| ... |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Sat Jul 29, 2006 8:53 pm Post subject: |
|
|
Hi Nico,
Anywhere in your code add:
| Code: |
| $_cal_html->js_onload[] = "upd_custfields();" |
|
|
| Back to top |
|
 |
smeallum
Joined: 17 May 2006 Posts: 177
|
Posted: Fri Aug 04, 2006 2:41 am Post subject: |
|
|
Hi...
After putting several custom fields between span and new_row()/end_row() as discussed in this post, all this custom fields appear totally aligned to the left of the edit event form, as opposed to the standard fields which are padded a little to the right(as usual).
what would i need to do to have the custom fields show aligned with the rest of the standard fields?
Cheers,
NiCo |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Fri Aug 04, 2006 2:43 am Post subject: |
|
|
Hi,
Instead of using new_row()/end_row() use section_row(). E.g.
$_cal_tmpl->section_row("Field label", $_cal_form->textbox('x')); |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Aug 04, 2006 2:51 am Post subject: |
|
|
mmmm...
You recommended the new row() and spans so i could group certain custom fields in groups to show/hide them depending on event category chosen(take a look at the previous page of this post).
So i think if i change all back to section_row... i'll change the current functionality, right? |
|
| Back to top |
|
 |
smeallum
Joined: 17 May 2006 Posts: 177
|
Posted: Fri Aug 04, 2006 2:52 am Post subject: |
|
|
| ... |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Fri Aug 04, 2006 3:13 am Post subject: |
|
|
Then keep the new_row()/end_row()? The other fields appear aligned because they use section_row(). It would be a lot easier to recommend something if I could see it. Could you give me the URL please?
Thank you |
|
| Back to top |
|
 |
smeallum
Joined: 17 May 2006 Posts: 177
|
Posted: Mon Aug 07, 2006 4:20 am Post subject: |
|
|
So does that mean that i won't be able to put those groups of custom fields(i used spans and new row()) in a new section?
Cheers,
NiCo |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Mon Aug 07, 2006 10:21 pm Post subject: |
|
|
Hi,
It depends on how you would like them displayed. You can still use:
$_cal_tmpl->section_row("", "<span id='x'> ...");
Those are the two options. That would leave a space in the screen if that is hidden. Try both ways and see which one you like best. |
|
| Back to top |
|
 |
smeallum
Joined: 17 May 2006 Posts: 177
|
Posted: Tue Sep 19, 2006 5:29 pm Post subject: |
|
|
| ian wrote: |
Hi Nico,
Anywhere in your code add:
| Code: |
| $_cal_html->js_onload[] = "upd_custfields();" |
|
Hi ian,
When i used the add event in wrapped mode, the javascript function worked nicely both when i change a category and also in the loading on the form.
However, now that i started using the Joomla Studio add event component, it only works on change, but not on load.
Any clue why?
Cheers,
NiCo |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Tue Sep 19, 2006 5:40 pm Post subject: |
|
|
Yes. When thyme is embedded in Joomla Studio, $_cal_html->print_footer() is not activated. This is where the JavaScript would be printed. Another solution would be to add this at the bottom of the Joomla Studio page where the event add/edit form is after ?>:
| Code: |
<script language='javascript' type='text/javascript'>
upd_custfields();
</script> |
|
|
| Back to top |
|
 |
smeallum
Joined: 17 May 2006 Posts: 177
|
Posted: Tue Sep 19, 2006 5:46 pm Post subject: |
|
|
that was it...thanks  |
|
| Back to top |
|
 |
smeallum
Joined: 17 May 2006 Posts: 177
|
Posted: Sun Nov 05, 2006 7:14 pm Post subject: |
|
|
| ian wrote: |
Hi Kent,
This will require some PHP knowledge. You may add custom fields to events by:
Let's say the field is called Price.
1) Adding the field to the Events table. You may do this through any SQL server admin program. MyPHPAdmin etc.. Create a field in the table called Price.
2) Adding the field to include/templates/event_edit_tpl.php. Add a text box to the form where users may enter a price. Make sure to name the text box 'Price'. You can do this by adding something like:
$_cal_tmpl->section_row("Price", $_cal_form->textbox('Price'));
3) Adding Price to include/templates/event_view_tpl.php. You could do something like:
$_cal_tmpl->section_row("Price", $_cal_event->Price);
Don't hesitate to ask any questions if you have them. |
ian...
what about the request events table and the passing from there to the events table when the event is apprved? Doesn´t the custom fields need to be added there too?
Cheers,
NiCo |
|
| Back to top |
|
 |
|