Path_selector widget required true is not working

I have patch_selector widget with required true option, but I can submit with empty field w/o choosing a file.


  • select_sim_file

widget: “path_selector”
required: true
required: true
directory: “/fs/home”

It’s what I see in the log file
App 4003 output: a-option-for-auto-accounts-satellites\"=>false}], [\"medprio_nolim\", \"medprio_nolim\", {\"data-option-for-cluster-amp\"=>false, \"data-option-for-cluster-phoenix\"=>false, \"data-option-for-auto-accounts-flamingo\"=>false, \"data-option-for-auto-accounts-satellites\"=>false}], [\"modelcheck\", \"modelcheck\", {\"data-option-for-cluster-amp\"=>false, \"data-option-for-cluster-phoenix\"=>false, \"data-option-for-auto-accounts-flamingo\"=>false, \"data-option-for-auto-accounts-satellites\"=>false}], [\"test\", \"test\", {\"data-option-for-cluster-amp\"=>false, \"data-option-for-cluster-phoenix\"=>false, \"data-option-for-auto-accounts-flamingo\"=>false, \"data-option-for-auto-accounts-satellites\"=>false}]], :value=>\"test\"}>, #<SmartAttributes::Attributes::BcNumSlots:0x00007f4ca4057ba0 @id=\"bc_num_slots\", @opts={:help=>\"This adds a number that describes the number of processors, CPUs on a single node, or nodes that the submitted job may use\", :value=>\"1\"}>, #<SmartAttributes::Attributes::BcNumHours:0x00007f4ca4057560 @id=\"bc_num_hours\", @opts={:min=>1, :step=>1, :value=>\"1\"}>, #<SmartAttributes::Attribute:0x00007f4ca4056f98 @id=\"select_sim_file\", @opts={:widget=>\"path_selector\", :directory=>\"/fs/home\"}>, #<SmartAttributes::Attribute:0x00007f4ca4056d68 @id=\"select_initial_file\", @opts={:widget=>\"path_selector\", :directory=>\"/fs/cluster/data\", :value=>\"\"}>, #<SmartAttributes::Attribute:0x00007f4ca4056638 @id=\"select_macro_file\", @opts={:widget=>\"path_selector\", :directory=>\"/fs/cluster/data\", :value=>\"\"}>, #<SmartAttributes::Attributes::BcEmailOnStarted:0x00007f4ca4056098 @id=\"bc_email_on_started\", @opts={:value=>\"0\"}>], @app_specific_cache_setting=nil, @errors=#<ActiveModel::Errors:0x00007f4ca1571120 @base=#<BatchConnect::SessionContext:0x00007f4ca45b7c80 ...>, @errors=[]>>, @object_name=\"batch_connect_session_context\", @default_options={}, @default_html_options={}, @multipart=nil, @index=nil>\n\n form.send widget,, all_options\n ^^^^^\nDid you mean? text_field):\n 3: \n 4: <%= bootstrap_form_for(@session_context) do |f| %>\n 5: <% f.object.each do |attrib| %>\n 6: <%= create_widget(f, attrib, format: @render_format) %>\n 7: <% end %>\n 8: \n 9: <%- if Configuration.bc_saved_settings? -%>\n \napp/helpers/batch_connect/session_contexts_helper.rb:39:in create_widget’\napp/views/batch_connect/session_contexts/_form.html.erb:6\napp/models/batch_connect/session_context.rb:43:in each'\napp/models/batch_connect/session_context.rb:43:in each’\napp/views/batch_connect/session_contexts/_form.html.erb:5\napp/views/batch_connect/session_contexts/_form.html.erb:4\napp/views/batch_connect/session_contexts/new.html.erb:86"`

Any help appreciated.

Sorry for the issue.

Are you saying when you submit without having selected a file or directory, it throws this error?

Does this then take you to the index page of your running apps to login to with some kind of failure for this?

I’m trying to replicate with some apps on my end where I’m setting a directory and just hitting launch without the selection but not getting the same result. But maybe that’s the wrong sequence.

Sorry if I didn’t explain it clear.

I’m able to submit a job w/o selected file even if I say it’s a required field. So it’s working, but it shouldn’t be.

I’m not sure if log message is relevant, but I thought I will post it here just in case, because usually ppl ask for the log anyway.

I hope it makes sense.

Thanks for the clarification. I’m running this on OOD 3.1.0 currently and not able to get the same behavior. Instead I hit an error around the working_dir not being set for the app.

What version of OOD are you running?

OnDemand version: 3.1.1

Hmm, I just built with 3.1.1 and tried again with no luck.

What happens if you delete the form.js file in the app directory, then reload that page and try again?

I don’t have for.js I have form.yml.erb and submit.yml.erb

Thanks for the patience on this. I was hoping another fix would work here.

Could I ask what app you are trying to launch? I’m currently testing with codeserver myself.

Also, what OS are you on?

I’m on CentOS 8.

I’m trying to make a submit page to allow users submit jobs from web-interface. Not an interactive app, just simple submit job. Right now I’m testing with Ansys application and I need users to be able to choose their simulation file and it needs to be required field.

Kinda like job composer but w/o direct editing batch script - submitting just by clicking buttons.

I hope it makes sense.

Ahh, ok. Yeah that’s more involved than what I had thought.

So the idea is you are using the batch_connect form to launch the job, but not be interactive. Instead to have the code loaded and run and the output landed somewhere? Is that correct?

If so, you’ll likely need to be checking the submit.yml.erb for what’s going wrong currently. Because it’s odd that this will launch and not even trigger BatchConnect errors, but that the submit.yml.erb has changes now that makes more sense.

Are you able to share the submit.yml.erb? This might not be easy to accomplish, but I’m happy to try and help out.

There is not much going on right now. I’m just mostly testing fields on the form. I don’t have any problems submitting my job. The problem is that required: true is being ignored for the path_selector field. I have required true for the job name field and that is working ok. I cannot submit w/o job name:

So it sounds more like a Ondemand bug than anythign else.

This is my submit:


  • “–job-name”
  • “<%= job_name %>”
  • “–ntasks”
  • “<%= num_cores %>”

license = if solver == “Ansys - Linear” || solver == “Ansys - Thermal”
elsif solver == “Ansys - Non-Linear”
elsif solver == “CFX” || solver == “Fluent”
elsif solver == “Star-CCM+”

  • “–license”
  • “<%= license %>”
    chdir = File.dirname(select_sim_file)
  • “–chdir”
  • “<%= chdir %>”
  • “–error”
  • “%x.%j.out”
  • “–output”
  • “%x.%j.out”

@jeff.ohrstrom just curious if you know if it’s a known bug.

Yea it is. It’ll be fixed in 3.0.2, I’ve already patched it, I’m just waiting for other bugs to be fixed before releasing it.

I’m on OnDemand version: 3.1.1 Can I patch it in 3.1.1 ?

Another weird behaivor I see with path selector widget when I make it hidden, it hides the text filed but not the button.

I reported it here:

Sure, just take a backup of the original files so you can fix it if things go south, which they may. Editing the html files may not cause disruptions - but editing the actual .rb files may have unexpected consequences to the people who have active PUNs with the old files. So while you’re doing the work - I’d suggest you put OOD in maintenance mode or similar and restart everyone’s PUNs afterwards.

Here is the patch. You don’t need the test case update, just the updates in the other 2 files.

I just filed a bug for that. I’ll see what I can do for the 3.1 release cycle.

I got an error on the web-page:

#<NameError: undefined local variable or method `options' for #<ActionView::Base:0x00000000021368>
Did you mean?  url_options>

I can revert back, but I’m curious if you know what is wrong

You’re using options on line 15, but you have to define them on line 12.

My bad works like charm

1 Like