• Resolved krama757

    (@krama757)


    Hi Inapan,

    Great job making this plugin. It’s really versatile!

    Just had 3 “quick” questions for you and the community:
    – How would you validate the input in a custom field?
    Example: I have a custom field that asks the user for a date in mm-dd-yy format. If they enter hi-hi-hi, how would I take them back to the form submission page to make them correct this error?

    – How is the progress on showing only the visual editor going?
    The visual editor is so much more powerful than the regular form…it makes no sense for me to show just text boxes.

    – How would you resize the widget to only have a width of 1000 px instead of the default 100%?

    Thanks for the help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter krama757

    (@krama757)

    Hmm, figured out my own hacks to do the form validation and the widget resize. I also just hid the text area for the post content and now people are forced to use the visual editor.

    Solving problems is fun ??

    Plugin Author inapan

    (@inapan)

    @krama757

    I’m sorry I haven’t been able to dive into it yet. I have been very busy lately.

    Would you mind sharing your solutions on the forum so more of us can benefit from it.

    By the way, I agree with you: solving problems is fun (most of the time).

    inapan

    Thread Starter krama757

    (@krama757)

    Np Inapan…I’m just thankful that you made such an awesome plugin.

    I’ll give a brief idea of what I did:
    Question: How would you resize the widget to only have a certain width?
    Solution:
    In quickpost-widget.php:
    Place: “<div class=”quick_post”>” before the line “<form autocomplete=”off” method=”post” name=quickpostwidget action=”” >”
    Then place your “</div>” after the “</form>”.
    Now in your template files, you can add custom style sheets for div.quick_post to choose your width, height, etc.

    Question: How would you validate the input in a custom field?
    Solution: Look for for ($cfn = 1; $cfn <= $qpw_custom_fields_count; $cfn++) {
    Here, if you know what your customfields are going to be then you can individually check your custom field values by using:

    if($_POST['customfield_1'] == 'Some incorrect input'){
    $error = 'yes';
    								?>
    								<script type="text/javascript">
    									document.getElementById(<?php echo '\'' . $customfield . '\''; ?>).style.border="solid 1px <?php echo $error_color; ?>";
    								</script> <?php
    							}

    This should allow you to control and check the inputs of your various custom fields assuming you know what each custom field is supposed to be.
    Question: How do you hide the textbox for post-content so that only the visual editor is used?
    Solution:
    In your widget settings, go to the style setting for post content and enter “visibility: hidden; position: absolute; top: 0; left: 0;” into the textbox.

    That should effectively hide your post-content text box so people are forced to use the visual editor.

    Happy Coding!

    Thread Starter krama757

    (@krama757)

    Question: How do you hide the textbox for post-content so that only the visual editor is used?

    This question should be bolded in the previous post >.< I wish the forum had a front-end edit function ??

    Plugin Author inapan

    (@inapan)

    Thanks for sharing!

    inapan

    @krama757 Thanks for that…very useful tip for hiding the textbox.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Form validation’ is closed to new replies.