Jump to:

23370 Posts in 18145 Topics by 2864 members

General Questions

SilverStripe Forums » General Questions » UserForms problem?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 556 Views
  • Lemonie
    Avatar
    Community Member
    70 Posts

    UserForms problem? Link to this post

    I have created a form and included rules. Currently all the options are shown when the form is submitted even though they are blank and the user has never seen them from their selection. How can I stop this?

    Also I would like to process the data. So each time a record is entered with a reference number it goes to that separate record.

    Can somebody point me in the right direction .. please???

    Edited from: Is there a way to just show fields that have been filled in in the submitted section of the site. I have a form with rules and only want the relevant questions which have been answered shown?

  • Silverfish
    Avatar
    Community Member
    59 Posts

    Re: UserForms problem? Link to this post

    Sure.

    On creating the form you could just check for each field if there's a value for it and the decide wether to create / display this field or not.

    Regards
    SF

  • Lemonie
    Avatar
    Community Member
    70 Posts

    Re: UserForms problem? Link to this post

    Am a bit confused as am a newbie. I have all the fields with rules to hide and show on the actual form. It is on the submission that it is showing lots of blank fields. Am not sure how to do what you are explaining?

  • Lemonie
    Avatar
    Community Member
    70 Posts

    Re: UserForms problem? Link to this post

    OK .. I have found some code which I think does what I want ...

    *********

    $(function()
    {
    $("form").submit(function()
    {
    $(this).children(':input[value=""]').attr("disabled", "disabled");

    return true; // ensure form still submits
    }
    });

    *************

    $(':input').removeAttr("disabled");

    I have absolutely no idea where to put this code or if it is suitable? Please would somebody help?!

  • Lemonie
    Avatar
    Community Member
    70 Posts

    Re: UserForms problem? Link to this post

    If there is no way of omitting the blank fields then why offer dependant forms? Really struggling here.

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: UserForms problem? Link to this post

    Basically this is quite difficult, the visibile of the form field is handled in the front end and the form submission in the backend. The state of a field (visible vs hidden) isn't passed (if you have JS disabled, all the fields will be shown by default)

    556 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.