Jump to content


Photo

Module want: form builder


  • Please log in to reply
94 replies to this topic

#81 dhruba

dhruba

    Jr. Member

  • Members
  • PipPip
  • 38 posts
  • 3

Posted 06 August 2013 - 02:21 PM

Thanks I did this but I want it to be dynamic. Is there any way to change the module to set this dynamically. Like...............

 

$form->publish = true/false



#82 kongondo

kongondo

    Hero Member

  • Members
  • PipPipPipPipPip
  • 1,557 posts
  • 1305

  • LocationUK

Posted 06 August 2013 - 02:27 PM

Thanks I did this but I want it to be dynamic. Is there any way to change the module to set this dynamically. Like...............

 

$form->publish = true/false

 

I guess so. What boolean condition/logic do you want to check for?



#83 adrian

adrian

    Hero Member

  • Members
  • PipPipPipPipPip
  • 1,460 posts
  • 1194

  • LocationCanada

Posted 06 August 2013 - 02:28 PM

I don't think Ryan has that option in the module. The module code could be enhanced to handle that, or you could do something like this after rendering your form.

$newpage = $page->children->last();
$newpage->removeStatus(Page::statusUnpublished);
$newpage->save();
 

I think this should work.

 

EDIT: added the necessary save line at the end.

 

EDIT #2: Actually not sure if this will work at all - this could get messy if the form is rendered and not submitted and if someone else submits while another form is still being filled out. Sorry, might need to rethink this and go with editing the module code properly.

 

Ignore all the above and see http://processwire.c...uilder/?p=41431


Edited by adrian, 06 August 2013 - 05:23 PM.


#84 adrian

adrian

    Hero Member

  • Members
  • PipPipPipPipPip
  • 1,460 posts
  • 1194

  • LocationCanada

Posted 06 August 2013 - 02:41 PM

It might be best to go with something like:

 

$form->pagestatus = 'unpublished';

 

That way the module could simply grab "pagestatus" and add it to the page using addstatus before saving. I'll see if I can find a few minutes to modify the module to handle this.



#85 dhruba

dhruba

    Jr. Member

  • Members
  • PipPip
  • 38 posts
  • 3

Posted 06 August 2013 - 02:50 PM

I hv change the module............and it works ............ It needs three steps

 

Line No:                Add  this

90                           $this->set('publish', false);

110                          else if($key == 'publish' && $value) {

            if($value!=0&&$value!=1) throw new WireException('$page->publish value should be true or false');
            $this->publish = $value;
        
        }
 
210                               
if(!$this->publish)
            $this->contact->status = Page::statusUnpublished; 
 
 
 
 
and in your code just add   $form->publish = true;    and done.
 


#86 adrian

adrian

    Hero Member

  • Members
  • PipPipPipPipPip
  • 1,460 posts
  • 1194

  • LocationCanada

Posted 06 August 2013 - 02:57 PM

Nice - the only thing I was thinking by the approach I suggested is that it would allow you to also set the status to hidden, or any other option you wanted.



#87 dhruba

dhruba

    Jr. Member

  • Members
  • PipPip
  • 38 posts
  • 3

Posted 06 August 2013 - 03:02 PM

Thanks I will try that. I am just exploring the power of PW. After that where should I post the module for others.



#88 kongondo

kongondo

    Hero Member

  • Members
  • PipPipPipPipPip
  • 1,557 posts
  • 1305

  • LocationUK

Posted 06 August 2013 - 03:15 PM

After that where should I post the module for others.

 

Herehere  and here :)



#89 adrian

adrian

    Hero Member

  • Members
  • PipPipPipPipPip
  • 1,460 posts
  • 1194

  • LocationCanada

Posted 06 August 2013 - 03:39 PM

Here is a revised version of the module.

 

It accepts all Page::status options, eg.

$form->pagestatus = Page::statusUnpublished;

$form->pagestatus = Page::statusHidden;

 

If left blank, then the page will be published. Not sure if this is really an ideal default. Maybe it would be good to get some input from others on this.

Attached Files


Edited by adrian, 06 August 2013 - 04:20 PM.


#90 dhruba

dhruba

    Jr. Member

  • Members
  • PipPip
  • 38 posts
  • 3

Posted 07 August 2013 - 01:25 AM

Hi

 

Not able to add image fields in FormTemplateProcessor................HELP

Error: Exception: New page '/CMS/ProcessWire/embedded-c//' must be saved before files can be accessed from it (in Z:\web\CMS\ProcessWire\wire\core\PagefilesManager.php line 167)



#91 ryan

ryan

    Reiska

  • Administrators
  • 7,797 posts
  • 6572

  • LocationAtlanta, GA

Posted 09 August 2013 - 04:58 AM

That error messages sounds like you are trying to use a file or image field with FormTemplateProcessor, and file/image fields aren't supported with it. The error message should go away if you remove the file/image field. 



#92 DV-JF

DV-JF

    Jr. Member

  • Members
  • PipPip
  • 39 posts
  • 2

Posted 06 September 2013 - 11:16 AM

Hi,

 

is it possible to set the HTML5 placeholder attribute to a created text field?



#93 ryan

ryan

    Reiska

  • Administrators
  • 7,797 posts
  • 6572

  • LocationAtlanta, GA

Posted 08 September 2013 - 06:29 AM

Yes, there should be a placeholder option for any text-based field in ProcessWire. You'll see it when configuring it. To use it from the API side, you'd do:

$inputfield->attr('placeholder', 'your placeholder text'); 


#94 gebeer

gebeer

    Distinguished Member

  • Members
  • PipPipPipPip
  • 100 posts
  • 47

  • LocationGermany/Thailand

Posted 11 December 2013 - 04:32 AM

Hello,

 

I'm using latest version of this module with PW 2.3 and it's working fine so far.

 

But when in debug mode, it throws 2 notices/warnings:

 

Notice: Trying to get property of non-object in .../wire/core/Page.php on line 275

Warning: Invalid argument supplied for foreach() in .../wire/core/Page.php on line 275

 

My form has no fancy fields and is sending the input to an email.

 

There's one select field for a salutation (Mr., Mrs...). In the message that gets sent, the option values are put out instead of the option name. How can I change that?

 

Cheers

gerhard



#95 guenter55

guenter55

    Jr. Member

  • Members
  • PipPip
  • 24 posts
  • 3

  • LocationAustria

Posted 05 April 2014 - 12:25 PM

Hi,

 

for all german users of this FormTemplateProcessor.modul who want to get german Umlaute like öäüß and not found the issues to similar slovak characters on github.

 

After you have checked all the other solutions of that problem, like to save the page where the form is in "utf-8 without bom" and set the right header of the page, then only one is to do:

 

search in /site/modules/FormTemplateProcessor.module for

$value = htmlentities($this->contact->get($field->name));

and change to:

$value = htmlentities($this->contact->get($field->name), ENT_QUOTES, 'UTF-8');

This was the solution for me.

 

(Lösung für deutsche Umlaute im Kontaktformular)

 

Thanks for this fine modul, ryan!

 

_guenter_






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users