News:

Wondering if this will always be free?  See why free is better.

Main Menu

Custom Form Mod

Started by live627, July 09, 2008, 10:24:44 PM

Previous topic - Next topic

Garou

FragaCampos That's good and it works as manual quick fix, for an individual site. I couldn't include it in the mod that way though.

The code I have in mind for the mod would have a selectable option for the redirect in the forms settings that one could turn on and off. Then the code for the board would have to check to see if the option was turned on for that board in order for it to redirect. The code for the form settings would also have to check to make sure another form isn't already redirecting the new topic option for the board.

mpp, as of yet I haven't been able to reproduce the error.

FragaCampos

QuoteThe code I have in mind for the mod would have a selectable option for the redirect in the forms settings that one could turn on and off. Then the code for the board would have to check to see if the option was turned on for that board in order for it to redirect. The code for the form settings would also have to check to make sure another form isn't already redirecting the new topic option for the board.

Of course this would be just great, but untill you don't figure it out, this is a good "quick hack" that works and, in my case, is gold over blue for my forum.
With the attachment option would be even better  O:) ;D

tonnybarros

Staff have installed the MOD on SMF 2.0 and worked OK, but I translated the MOD in Modifications.portuguese_pt-utf8.php but still all in English, how can this happen?

I'm from Brazil and the translation was made by Google

Garou

If you entered the file through c-panel, ftp or some such then you need to clear the cache in SMF.
Admin -> Maintenance -> Routine -> Empty the file cache

mpp

Quote from: Garou on September 03, 2009, 11:22:48 AM

mpp, as of yet I haven't been able to reproduce the error.

You can try it on my forum...

http://alarius.mppsystems.com/board/index.php?action=form;id=1 [nofollow]

Try entering it\'s in the Weekly play times field.  You will have to register to use the form.

SMF 1.1.10 is the version I'm running.


Garou

That is interesting. I still haven't been able to get mine to do that. It just passes the entire "it\'s" through to the post.

Have you made any adjustments to the mod? Outside of that it could be another mod or something in the theme. Outside of that is there some reason that someone other then some sort of Spam Bot would actually need to enter that type of comment? Like I said traditionally that is HTML code that tells a server to treat the apostrophe as actual text rather then interpreting it as code.

mpp

I've installed the mod without any changes.  And its not a big deal if you can't track it down, or its something with the theme thats installed.  It simply got triggered by someone making a typo in the form, but figured I'd report it.  Thanks for trying!

tonnybarros


Reinaldo23

hi i have a doubt:
I installed the system tags as I do to create a form to fill out the field labels (the new Topic)?

thank you very much in advance and for this excellent work ;)

Garou

Reinaldo23, I'm not sure if I understand what you asking for.

If you are asking how to create a form, try...
http://www.simplemachines.org/community/index.php?topic=248871.msg1633514#msg1633514

If you are asking about using the new topic button to redirect to a form, try
http://www.simplemachines.org/community/index.php?topic=248871.msg2241024#msg2241024


Reinaldo23

I have this mod

http://custom.simplemachines.org/mods/index.php?mod=579


as I fill in a form field which brings the mod tags

Garou

Are you asking to include the Tagging System into the Custom Form Mod?

If that's the case, I have to say no. At the very least not anytime soon. There are too many other features to include in the Custom Forms Mod itself without having to include features from other mods. Sorry.

Reinaldo23

not only want to create a form to fill in the form of tag system

C4G-TK

How do I go about changing the display of the form?

I'm not talking about the post that is made, but the form page that appears AFTER you select the form you want to see.

Currently, it is pulling the background color and I would like it to pull the same info as the rest of the form itself.

I want the dark brown area that is circled to be the same as the other part of the container.


-img removed-

Garou

That's odd, what did you change to get there?

In the CustomForm.template.php...
Through out the default template: function form_template_submit_form() you should see several instances of class="windowbg2". They all should be the same except at the top where it says,  class="titlebg" having that as a different class will highlight the title area better.

You could use any type of style info like...
<tr style="background-color:brown;>
...but I would recommend adding a new class to the bottom of your themes style.css

Something like...
.mybg
{
color: #000000;
background-color: brown;
}


Then change class="windowbg2" to class="mybg"

I would also recommend creating a Custom Template Function of your own for this. Copy this...
// Begin: Racing League Form Template

function form_template_racing_form()
{
global $context, $txt, $settings, $scripturl;

// Starting text for the form and tables. Don't muck with this unless you need to change the style!!!  ;)
echo '
<form action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '">
<table width="80%" border="0" cellspacing="0" cellpadding="0" class="tborder" align="center">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="4" width="100%">
<tr class="titlebg">
<td colspan="3">', $context['settings_title'], '</td>
</tr>';

   //   Here you can add information at the top of your form, if you want to...
   /* echo '
<tr class="windowbg2">
Example of something above the form title area.
</tr>
<tr>
<td colspan="3"  class="windowbg2">
Example of something at the top of the form.
</td>
</tr>';*/
   // End of information in the top section.

// Documentation for the contents of each $field_data array, or entry into the $context['fields'] array.
/*
$field_name = The name of the field, straight from the value stored by the admin in the admin settings area;
$field_data = array(
'text' => This is the text which needs to be displayed next to the setting.,
'type' => The type of input which the field is ,
'value' => The value of the field, if this is not the first attempt at submitting the form,
'data' => The list of options - only for the selection box type,
'required' => A boolean value telling us wether or not its necessary to have a valid value for this field in order to submit the form,
'failed' => A boolean value which tells us wether or not this field caused the form to fail to submit,
);
*/

// Now actually loop through all the fields.
foreach ($context['fields'] as $field_name => $field_data)
{
// Output the start of the row, as well as a spacer column.
echo '
<tr class="windowbg2">
<td class="windowbg2"></td>';

if ($field_data['type'] == 'infobox')
echo '
<td colspan="2" valign="top"><label for="', $field_name, '">', $field_data['text'], '</label></td>
';
else

// Show the display text for this field.
echo '
<td valign="top"><label for="', $field_name, '">', $field_data['text'], '</label></td>
<td class="windowbg2" width="50%">';

// Show a check box.
if ($field_data['type'] == 'checkbox')
echo '
<input type="checkbox" name="', $field_name, '" id="', $field_name, '" ', (($field_data['value']) ? ' checked="checked"' : ''), ' value="1" class="check" />';

// Show a selection box.
elseif ($field_data['type'] == 'selectbox')
{
echo '
<select name="', $field_name, '" id="', $field_name, '" >';
foreach ($field_data['data'] as $option)
echo '
<option value="', $option, '"', ($option == $field_data['value'] ? ' selected="selected"' : ''), '>', $option, '</option>';
echo '
</select>';
}
// Show a radio box.
elseif ($field_data['type'] == 'radiobox')
{

            foreach ($field_data['data'] as $option)

            echo '
                 
                        <input type="radio" name="', $field_name, '" value="', $option , '">', $option , '<br />';
     }
// Large Text box?
elseif ($field_data['type'] == 'largetextbox')
{
echo '
<textarea rows="5" cols="45" name="', $field_name, '" id="', $field_name, '">', $field_data['value'], '</textarea>';
}
// Show a Info box.
elseif ($field_data['type'] == 'infobox')
{
echo '
';
}
// Int, Float or text box?
else
echo '
<input type="text" name="', $field_name, '" id="', $field_name, '" value="', $field_data['value'], '" />';

// Show the 'required' asterix if necessary.
if(!empty($field_data['required']))
echo '
<div ', !empty($field_data['failed']) ? 'style="color:#FF0000;"' : '' ,'> *</div>';

// End the input column and the entire row.
echo '
</td>
</tr>';
}

    //    Show the "Required Fields" text down the bottom, show it in red if there was a failed submit.
   echo '
               <tr class="windowbg2">
                  <td colspan="3" style="text-align:center;', !empty($context['failed_form_submit']) ? 'color:#FF0000;' : '', '">
                     * ', $txt['CustomForm_required'], '
                  </td>
               </tr>';
               
   //  Here you can add information before the submit button.
   /* echo '
<tr>
<td colspan="3"  class="windowbg2">
Example of something before the submit button.
</td>
   </tr>'; */ 


// Output the save button, the end of the tables and the form.
echo '
<tr>
<td class="windowbg2" colspan="3" align="center" valign="middle"><input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled="disabled"' : ''), ' /></td>
</tr>';

  //   Here you can add information below the submit button.
  /* echo '
<tr>
<td colspan="3"  class="windowbg2">
Example of something after the submit button.
</td>
</tr> */

</table>
</td>
</tr>
</table>
<input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';
}
// End: Racing League Form Template


Make your changes and paste it just before the ?> at the bottom of your CustomForm.template.php.

Then in your forms Settings where it says Custom Template Function, enter "racing_form"

C4G-TK

#735
Quote from: Garou on September 14, 2009, 01:18:19 PM
That's odd, what did you change to get there?


The only thing that I had changed was in the style.css file.  I read in another thread that in order to change the background color, you should add background-color to the following area, so I did.

/* use dark grey for the text, leaving black for headers etc */
body, td, th , tr
{
color: #444444;
background-color: #A19675;
}



Thanks!


I removed this now and it seems to have remedied my problem, but now I need to get the background fixed.  I don't want to hijack your thread here, so I'll continue this here for help:

http://www.simplemachines.org/community/index.php?topic=336405.msg2257681#msg2257681

-img removed-

rgecy

I recently upgraded from 1.1.9 to 2.0 RC 1.2.  I had the Custom Form mod installed and of course when I upgraded, I had to reinstall.  Now I am getting a Database Error at install.

Database Error
Table 'sid0908711353209.cf_forms' doesn't exist
File: /home/content/r/g/e/rgecy1/html/forums/Packages/temp/install.php
Line: 45 

Any idea whats happening or maybe one of the old files messing things up?

Robert

Garou

C4G-TK, that's probably for the best. Ive never been that good at creating themes, I just don't have the knack for it I guess. Ive been working on one of my own off and on for about a year now and still cant get it to look the way I want. LOL

rgecy, you installed the mod and uninstalled it at some point in the past. The old data bases are still there and causing the problem. You will have to manually drop them using phpmyadmin or a similar program, Drop  the cf_fields and cf_forms. If there is old data that you want to save you should back them up first then once the mod is installed you can import the old ones back in.

This is a problem in the 2.0 series of SMF http://dev.simplemachines.org/mantis/view.php?id=2963 Hopefully they will fix it in the next release of SMF, in the meantime I'm trying to get some kind of work around set up to prevent this.


rgecy

Thanks for the help.  Back up and running.  I had never done that before.  Pretty cool and not to difficult.

Thanks again.

Robert

tonnybarros

   
For me it shows "Required Fields" and "Submit Form" has looked at everything, what to do.

Advertisement: